Set up SSH key authentication
In order to transfer information between GitHub or Gitlab and your local machine, you need to authenticate yourself to the remote server. If you use GitHub + GitHub Desktop, they take care of this for you. Otherwise, you need to setup SSH authentication with SSH keys. You can also authenticate using a personal access token (PAT) instead but here we will stick with SSH keys here.
If you want a good and simple explanation of how SSH works, checkout the video below
Check of you already have an SSH key set up
If you are not sure if you already set up authentication via ssh on your machine, you can try the following:
- Can you push to GitHub/Gitlab from the command line without having to provide credentials (except for SSH key password)?
- If yes, then you already set up authentication.
- Run
ssh -T git@github.com
orssh - T git@gitlab.com
in the terminal (Git bash for Windows users). If GitHub/Gitlab welcomes you with your correct user account, you are all set.
If you don’t have an SSH key set up, please follow the steps below.
SSH-authentication for Gitlab
Please follow this guide
If you prefer a video, you can check out this one. It is for Gitlab but works the same for GitHub.
SSH-authentication for GitHub
Complete the following steps:
Test the connection
To test if the setup was successful, run ssh -T git@github.com
or ssh -T git@gitlab.com
and see if Gitlab or GitHub answer to you.