Join the community!
Visit our GitHub or LinkedIn page to join the Tilburg Science Hub community, or check out our contributors' Hall of Fame!
Want to change something or add new content? Click the Contribute button!
This building block takes you through the steps to configure Git on a new virtual machine (VM) on Research Cloud once you have finished setting up your account and creating a workspace following these steps.
Setting up SSH key authentication
Step 1: Create your SSH keys
You can access and write data in remote repositories on Github using SSH (Secure Shell Protocol). When you connect via SSH, you authenticate using a private key file on your local machine. To create the SSH key:
Go to the directory
cd .sshcommand on the terminal and create a ‘config’ file using
Then, create your SSH keys with the
ssh-keygencommand. Click enter to save the key in the default directory specified or mention an alternative directory if you would like to save it elsewhere. Then you may enter a passphrase for your private key, providing an additional layer of security.
Now, we have generated two keys that are required for SSH authentication: private key (id_rsa) and the public key (id_rsa.pub).
You could also create additional storage drive and link it to the instance when creating one. Then make sure to save the SSH key files in this external drive. This will be helpful when for example, you delete your current VM and mount this external drive to a new VM. In this case, you need not configure git from scratch again.
Step 2: Configure SSH
If you configure multiple keys for an SSH client and connect to an SSH server, the client can try the keys one at a time until the server accepts one but this process doesn’t work because of how Git SSH URLs are structured. Hence, you must configure SSH to explicitly use a specific key file. To do this, edit your
~/.ssh/config file using the
nano command and copy-paste the following and press F3 to save.
Make sure to change the ‘IdentityFile’ to the directory where the id_rsa key is saved.
Step 3: Adding a New SSH key to your Github Account
- Open the public key using the
catcommand and copy the SSH public key to your clipboard.
- Go to your Github page and click on
SSH and GPG keys>
New SSH keyand paste the key here.
- Lastly, to make sure the key file is readable and writable only by the owner run
chmod 600 ~/.ssh/config
- Now, clone the repository using the SSH URL