Skip to content

Setting up SSH Access To your Repo

Dan Walkes edited this page Aug 28, 2021 · 4 revisions

While it's possible to clone a repository with HTTPS URLs and use Personal Access Tokens, this scheme is less flexible and doesn't work with some of the authentication methods we'll use later in the course. It's easier to start out using SSH keys and I suggest you start your assignments this way.

See the instructions at https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh to setup SSH access. The basic steps are:

  • Generate an SSH key pair
  • Add the public SSH key to your Github profile.
  • Use the SSH URL (not the HTTPS URL) to clone or otherwise push/pull to/from your repository.

image

Troubleshooting

To test whether you are using SSH keys for access instead of HTTPS and personal access tokens, you can use git remote get-url origin. If the response starts with https:// you are using https instead of SSH to access your repository. To fix this, use git remote set-url origin <ssh url> where <ssh url> is available in the SSH tab from the clone display dialog of your repository. See instructions in https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories#switching-remote-urls-from-https-to-ssh