How to Connecting GitHub to Git SSH
Steps for Generating an SSH Key
-
Generate an SSH key (press
Enter
to accept the default file location):ssh-keygen -t ed25519 -C "your_email@example.com"
-
Add the SSH key to the SSH Agent:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519
-
Add the SSH key to GitHub:
cat ~/.ssh/id_ed25519.pub
- In GitHub SSH settings, click “New SSH key” and paste the copied key (the whole .pub file’s contents) as “Authentication Key”.
- Add a title that helps you remember which machine it refers to.
-
Testing the connection
Running
ssh -T git@github.com
in your terminal should return something like “Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.”