Set up SSH key authentication

In order to exchange information between GitHub and your local machine, you need to authenticate yourself to the remote server.

If you use GitHub + GitHub Desktop, authentication is handled for you using OAuth. During this process, GitHub Desktop securely stores your credentials in your operating system’s native credential store (Windows: Windows Credential Manager, macOS: Keychain Access, Linux: libsecret/gnome-keyring, depending on the distro).

Because Git itself can read from these credential stores, other Git clients (e.g. command line, RStudio, VS Code) can also use the same authentication. This works as long as you are using HTTPS URLs for your repositories.

If you prefer to use SSH for authentication (for automation, servers, or personal preference), you need to set up SSH keys and add them to GitHub. See the guide below for help on how to do this.

If you want a good and simple explanation of how SSH works, checkout the video below

SSH-authentication for GitHub

Complete the following steps:

SSH-authentication for Gitlab

If you use Gitlab instead of GitHub, 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.

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.