Copy your public key
Print your public key to the terminal and copy the entire output — from ssh-ed25519 (or ssh-rsa) all the way to the trailing email comment.
$ cat ~/.ssh/id_ed25519.pub ssh-ed25519 AAAA...XYZ you@machine. Select and copy the whole line — including the email at the end. .pub file. Your private key (id_ed25519) must never leave your machine. Open GitHub SSH settings
Log in to GitHub, then navigate to your SSH key management page. You can follow the menu path or go directly via URL:
https://github.com/settings/keys Add the new SSH key
On the SSH and GPG keys page, click New SSH key. Fill in the form:
# Title — something memorable Title: Work MacBook Pro # Key type — leave as default Key type: Authentication Key # Key — paste your public key here Key: ssh-ed25519 AAAA... you@machine
Then click Add SSH key and confirm with your GitHub password if prompted.
Test the connection
Back in your terminal, run the SSH test command. This authenticates to GitHub's endpoint and confirms your key is recognised — without granting any shell access.
$ ssh -T git@github.com If prompted about the host fingerprint, type yes to trust it. You should see:
Clone or switch repos to SSH
Your key is live. Use SSH URLs going forward. To switch an existing repo from HTTPS to SSH:
$ git remote set-url origin git@github.com:user/repo.git
Or clone a new repo with an SSH URL:
$ git clone git@github.com:user/repo.git
Verify the remote is correct with:
$ git remote -v You're all set
Your machine is trusted by GitHub via SSH. git push, pull, and fetch over SSH will now work without entering a password or personal access token. Add more keys anytime at github.com/settings/keys.