Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.08 KB

git-ssh.md

File metadata and controls

36 lines (24 loc) · 1.08 KB

GitHub SSH

Generate a key with your own email or label:

ssh-keygen -t ed25519 -C "you@example.com"

Keep the private key on your computer. Add the contents of the public key to GitHub under Settings > SSH and GPG keys:

cat ~/.ssh/id_ed25519.pub

On macOS, copy the public key directly:

pbcopy < ~/.ssh/id_ed25519.pub

Test authentication and inspect the repository remote:

ssh -T git@github.com
git remote -v

To use SSH for a repository, replace OWNER and REPO:

git remote set-url origin git@github.com:OWNER/REPO.git

GitHub verifies signatures made with your private key against the public key registered to your account. The private key stays on your machine. If the key has a passphrase, an SSH agent can remember it for convenience.

See GitHub's guides to testing SSH and adding a key to ssh-agent.