Setting Up SSH for GitHub
Several UASAL repositories require ssh keys to be configured in order to clone a repository or install a package. Follow this tutorial to set up an ssh key for GitHub.
1. Generate an SSH Key
Open a terminal.
Run the following command, replacing
your_email@example.com
with the email associated with your GitHub account:ssh-keygen -t ed25519 -C "your_email@example.com"
When prompted, type the path and name of the key, hitting Enter to save it:
$ Generating public/private ed25519 key pair. $ Enter file in which to save the key (/home/username/.ssh/id_ed25519): /home/username/.ssh/key_name
Enter a secure passphrase (optional, but recommended).
2. Add the SSH Key to the SSH Agent
Start the SSH agent in the background:
eval "$(ssh-agent -s)"
Add your private key to the SSH agent:
ssh-add ~/.ssh/key_name
2. (Alternate) Add target to SSH Config
Modify ~/.ssh/config and add the following:
Host github.com HostName ssh.github.com Port 443 IdentityFile ~/.ssh/key_name
3. Add the SSH Key to GitHub
Copy your public key to the clipboard:
cat ~/.ssh/key_name.pub
Go to GitHub SSH Key Settings.
Click New SSH key.
Paste your public key into the “Key” field.
Give it a descriptive title.
Click Add SSH key.
4. Test the SSH Connection
Run the following command to verify the connection:
ssh -T git@github.com
If successful, you should see a message like:
Hi <your-username>! You've successfully authenticated, but GitHub does not provide shell access.
Troubleshooting
If you encounter
Permission denied (publickey)
, ensure that:Your SSH key is added to GitHub and has not expired.
The SSH agent is running and the key is added (
ssh-add -l
should list your key).You are using the correct SSH URL.
Now you are ready to securely interact with GitHub using SSH!