Using the SSH protocol to connect from DataHub to GitHub

One can also use the SSH protocol to interact with GitHub, rather than HTTPS, as we have been doing.

When cloning a repository, it would look like this (note git@github.com: instead of https://github.com/):

git clone git@github.com:<your_username>/newton-practice.git

Then for authentication, you would set up an SSH key pair with:

Software Carpentry has detailed instructions

If you run ssh -T git@github.com you’ll be able to verify if you’ve set things up correctly.

Note that if you initially set up your local repository to use HTTPS, you’ll need to reconfigure things to use SSH. You can run this:

git remote set-url origin git@github.com:<your_username>/newton-practice.git

Then to verify the change:

git remote -v

and you should see “git” rather than “https” in the result.