Connecting to GitHub via SSH

How to setup SSH authentication from your ASURITE login to GitHub.

 Instructions

  1. Log into the supercomputer and start a terminal session.

  2. Change the working directory to ~/.ssh with the command: cd ~/.ssh

  3. Create a new SSH key with the command:
    ssh-keygen -t ed25519 -f ~/.ssh/github_ed25519 -C $USER@asu.edu
    This generates a public and private cryptographic key. A public cryptographic key is analogous to an ideal physical lock and a private cryptographic key is analogous to a physical key: it is safe to distribute and share the public key, but the private key must be carefully and dutifully protected.

  4. Modify your SSH configuration by running the following command to append a new host entry:

    $ cat >> ~/.ssh/config << EOF Host github.com User git Hostname github.com IdentityFile ~/.ssh/github_ed25519 EOF

    Be sure that the IdentityFile matches the path chosen in the previous step.

  5. Copy the SSH public key to your clipboard.

    If your SSH public key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

    $ cat ~/.ssh/github_ed25519.pub ssh-ed25519 AAAAD3NzaC1lZDI1NTE5AAAAIJ+UnR+3dxsCWFy3IJa .... .......................... uzIkhzlHR0Exi2dSgr3p8= sparky@asu.edu # Select and copy the printed contents from this command to your clipboard # for use in the following steps on github.com
  6. On your computer open GitHub.com and log in. In the upper-right corner of any page, click your profile photo, then click Settings.

  7. In the user settings sidebar, click SSH and GPG keys.

  8. Click New SSH key or Add SSH key.

  9. In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "ASURITE on RC Supercomputer".

  10. Paste your key into the "Key" field. then click Add SSH key.

  11. If prompted, confirm your GitHub password

After making this change you will need to use the SSH option when you clone a repository. If you have existing repositories were setup with HTTPS follow these instructions to Switch Remote URLS from HTTPS to SSH.