How to install git

Installing and setting up git on your computer

This article needs testing.

To really use the benefits of git you need to install it to your computer and set it up to work with SSH Keys .

Install git

sudo apt install git-all

# set your username and email
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Set up the SSH key pair

If you do not already have one, generate a SSH Key pair :

ssh-keygen -t rsa -b 4096 -C "<YOUR-EMAIL-ADDRESS>"

A private and a public key will be saved on your computer. Usually you will find them at ~/.ssh/. The files will be called id_rsa and id_rsa.pub, where the file with the name ending ‘pub’ is the public key.

Add the git.rwth-aachen to your trusted hosts

You need to adapt this command, if you are not working on this GitLab instance. You also need an account there: How to set up GitLab at RWTH Aachen

ssh-keyscan -H git.rwth-aachen.de >> ~/.ssh/known_hosts

Transfer the public key to your GitLab profile

On the website of your GitLab instance, go to your User Settings->SSH Keys and paste the content of your public key. Be careful to copy the key exactly, without any spare spaces or end-of-line characters!

See also