Intro to git git push -f origin main 2025-09-22 Prabuddha Hans Git 2 / 63 Git • Git is tool that's used in the programming industry. 3 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. 4 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. • Specifically to track project work done, and the changes to files we've made. 5 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. • Specifically to track project work done, and the changes to files we've made. • The more correct term is Source Control. 6 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. • Specifically to track project work done, and the changes to files we've made. • The more correct term is Source Control. • It is NOT a programming language. 7 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. • Specifically to track project work done, and the changes to files we've made. • The more correct term is Source Control. • It is NOT a programming language. • Git is a tool made for (usually) us programmers to track the work we've done. 8 / 63 Git • Git is tool that's used in the programming industry. • Another name for Git is a Version Control System (VCS) tool. • Specifically to track project work done, and the changes to files we've made. • The more correct term is Source Control. • It is NOT a programming language. • Git is a tool made for (usually) us programmers to track the work we've done. 9 / 63 Sold Separately Programmer socks (not) included. 10 / 63 Why Git 11 / 63 Why Git • Now we need to ask WHY. 12 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? 13 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? 14 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. 15 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, 16 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. 17 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... 18 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. 19 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. • When DO we use git? 20 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. • When DO we use git? • Because Git keeps track of the changes we've made to files, 21 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. • When DO we use git? • Because Git keeps track of the changes we've made to files, • We can then use it to commit and stage these files, 22 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. • When DO we use git? • Because Git keeps track of the changes we've made to files, • We can then use it to commit and stage these files, • and push them to a place where we can store them. 23 / 63 Why Git • Now we need to ask WHY. • Why would we need a tool like this? • Why not use Google Drive instead? • I will find your IP address. • In all honesty, • It's to help keep track of who did what. • And to work on unique features... • without affecting the main area/branch of our work. • When DO we use git? • Because Git keeps track of the changes we've made to files, • We can then use it to commit and stage these files, • and push them to a place where we can store them. 24 / 63 Code Storage 25 / 63 Code Storage • This place is called a Repository. 26 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. 27 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. 28 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. • Meaning that if a project breaks, you can go back to before it broke. 29 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. • Meaning that if a project breaks, you can go back to before it broke. • Now I hear you nerds in the audience asking... 30 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. • Meaning that if a project breaks, you can go back to before it broke. • Now I hear you nerds in the audience asking... • Why not use SVN? 31 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. • Meaning that if a project breaks, you can go back to before it broke. • Now I hear you nerds in the audience asking... • Why not use SVN? • The answer is simple. 32 / 63 Code Storage • This place is called a Repository. • Repositories are hosted on websites like GitLab, GitHub and Forgejo. • But, an interesting feature of git, is that it allows you to time-travel. • Meaning that if a project breaks, you can go back to before it broke. • Now I hear you nerds in the audience asking... • Why not use SVN? • The answer is simple. 33 / 63 No. 34 / 63 WHY don't we use SVN 35 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. 36 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. 37 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. 38 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. 39 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. • You can work locally on git without having to be connected, 40 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. • You can work locally on git without having to be connected, • and then push once you're reconnected. 41 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. • You can work locally on git without having to be connected, • and then push once you're reconnected. • Back to git. 42 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. • You can work locally on git without having to be connected, • and then push once you're reconnected. • Back to git. • Let's start with the basics. 43 / 63 WHY don't we use SVN • An actual answer is that Git is Distributed, and SVN in centralized. • Simply put, devs can store their changes locally on their machines. • Whereas on SVN they're stored on a central system. • With a central system you NEED to be connected at all times to work on it. • You can work locally on git without having to be connected, • and then push once you're reconnected. • Back to git. • Let's start with the basics. 44 / 63 Don't do these types of commit messages 45 / 63 Live demonstration time • Please get your laptops out 46 / 63 How to download Git & Git LFS https://git-scm.com/downloads 47 / 63 How to download Git & Git LFS 48 / 63 How to download Git & Git LFS 49 / 63 How to download Git & Git LFS 50 / 63 How to download Git & Git LFS 51 / 63 How to download Git & Git LFS 52 / 63 LFS Install https://git-lfs.com/ Same deal as before, just download and install. It'll ask to be ran as Administrator, say yes. 53 / 63 Git && CI/CD https://forgejo.skynet.ie/Skynet/deploy_user 54 / 63 Git && CI/CD 55 / 63 Git && CI/CD 56 / 63 Setup SSH key (see Readme.md) 57 / 63 Setup SSH key (see Readme.md) 58 / 63 Setup SSH key (see Readme.md) 59 / 63 Setup SSH key (see Readme.md) cat ~/.ssh/skynet/$USERNAME
60 / 63 Setup Local repo git init -b main
git remote add origin <repo_url>
git pull origin main
git checkout -b main
# Edit src/index.html
git add src/index.html
git commit -m "my first commit"
git push origin main
Then go to: https://<username>.users.skynet.ie/ 61 / 63 View live Site https://<username>.users.skynet.ie/ 62 / 63 TroubleShooting ▓▓▓ If you see this: ▍ Credit: Geeks for Geeks
▓▓▓ Go here https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a -new-ssh-key-and-adding-it-to-the-ssh-agent 63 / 63