presentations_compsoc/slides/compsoc/2025-2025/intro_to_git.md

8.3 KiB

title sub_title author date theme
Intro to git git push -f origin main Prabuddha Hans 2025-09-22
name
catppuccin-latte

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.

=================================

Programmer socks (not) included.

image:width:100%

=================================

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.

=================================

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 in the audience asking...

=================================

Why not use SVN?

=================================

The answer is simple.

=================================

image:width:100%

=================================

An actual answer is that Git is Distributed, and SVN in centralized.

=================================

Simply put, devs can store their changes locally on their machines,

=================================

where 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.

=================================

Live demonstration time

Please get your laptops out

=================================

How to download Git & Git LFS

=================================

Download

<https://git-scm.com/downloads>

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

<https://forgejo.skynet.ie/Skynet/deploy_user>

================================= Don't do this image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

LFS Install

=================================

git lfs install

=================================

Setup SSH key (see Readme.md))

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

image:width:100%

=================================

git init
git remote add origin <repo_url>
git pull origin <branch_name>
git add <file_name>
git commit -m "<commit_message>"
git push origin <branch_name>

=================================

https://<username>.users.skynet.ie/

=================================

TroubleShooting

=================================

If you see this:

image:width:100%

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

=================================