Adding a new SSH key to your GitHub account
-
Copy the SSH public key to your clipboard. Use the following command, replacing the filename:
$ clip < ~/.ssh/{filename}.pub
Alternative for Windows users
On Windows Subsystem for Linux (WSL), you can use `clip.exe`. Otherwise, locate the hidden `.ssh` folder and copy the key manually.On newer versions of Windows with PowerShell, you may use:
$ cat ~/.ssh/{filename}.pub | clip
Alternatively, you can just open the file and copy its contents.
-
In the upper-right corner of any GitHub page, click your profile photo, then click Settings.
-
In the "Access" section of the sidebar, click SSH and GPG keys.
-
Click New SSH key or Add SSH key.
-
In the "Title" field, add a descriptive label for the new key (e.g., "Personal laptop").
-
Select the type of key: either authentication or signing.
-
In the "Key" field, paste your public key.
-
Click Add SSH key.
-
If prompted, confirm access to your GitHub account.