Installing and config

Why Version Control?

Git is a powerful tool that enables users to track changes in their files and directories, and collaborate with others in a seamless and efficient manner. It operates by having a central repository, which is typically hosted on a cloud-based platform such as GitHub or GitLab, that serves as the source of truth for all changes made to the files. This central repository is referred to as the "origin."

To use Git, you start by "cloning" the repository to your local machine. This creates a local copy of the repository on your computer, allowing you to make changes and modifications to the files. Once you have made the desired changes, you can "push" them back to the origin, merging your changes with those made by other users.

This version control system makes it easy to collaborate with others on a project, as it provides a clear and organized method for tracking changes and merging them into a common repository. Whether you're working on a personal project or collaborating with a team, Git is a valuable tool that can help you manage your code and keep track of the changes you make over time.

Install/Config Git

Generally git comes prepacked with modern Linux and Mac operating systems, but generally can be downloaded from the official website: Git.

Linux toolsets for Windows like Cygwin or WSL also generally come with git installed. Note that Cygwin is a Linux toolchain compiled specifically for use on Windows. Compare this to WSL which provides a Native Linux experience on/inside Windows.

For command line install (Linux/Mac):

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt update
$ sudo apt install git

Once installed, you'll need to do a little bit of configuration. Firstly, open your terminal and check that git is installed:

$ git --version

You should see something like this:

$ git version 2.35.1

This means that git has sucessfully installed. If this didn't work, take a look at this webpage.

Once installed, you can config git. First, set up git with your username and email address:

$ git config --global "your_username"
$ git config --global "[email protected]"

Then you need to setup sshkeys on the computers you'll be using. Github has dropped support on http authentication, so you'll need to use ssh. For more information about github's http deprecation have a look here.

Setting up GitHub

First you want to make a github account if you do not already have one. This will be the platform you'll use to store your origin files.

Note on Windows Gitbash

On installing Git on windows, an application called gitbash will have installed. This will allow you to run any linux command line commands on windows.

Setup SSH Keys

What are SSH Keys?

SSH Keys are used with the SSH network protocol for safely encrypting and transferring data between computers. SSH is a protocol that allows computers to communicate securely without the need for a password. For more information on the SSH protocol, have a look at this page.

Creating an SSH Key

You will need to create an SSH key on the computer you're using and copy this over to github. So when you try to connect, you'll will be authenticated using this key.

You may already have an ssh key. So first check these locations for a file call


In windows this is found in Users/<user>/.ssh


In linux it's found at ~/.ssh Change to ssh directory:

$ cd ~/.ssh

Then list contents of directory:

$ ls

You're looking for a file name ''. If you don't see this, you'll need to create one.

If you have one then skip this step.

Create an ssh key by running this command:

$ ssh-keygen -C <youremail>

If it prompts for a place to save just push enter. Do the same for password (just push enter).

Copy SSH public key to clipboard

Copy your ssh public key - found in previously mentioned locations.

$ cat ~/.ssh/

Highlight and copy the text.

OR copy using the command

$ pbcopy < ~/.ssh/

On windows you can do the same command from gitbash or find in Users//.ssh and copy it.

Paste SSH public key into GitHub

  1. Go into settings in github. github-settings
  2. Click on SSH and GPG keys on the left side bar. github-ssh-tab
  3. Select new SSH key (green bubble to right). github-new-ssh
  4. Paste the SSH key with whatever title you want and hit Add SSH key. github-added-ssh

Finishing Up

You're all set. Now you'll will be able to interact with github using git. Take a look at the next tutorial to get started using git with github.