- Make a key pair
(press enter instead of typing a passphrase. note that -C is just a comment)ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/github - Configure your ssh tool to use the keypair by modifying
~/.ssh/configecho ' HOST *github* AddKeysToAgent yes IdentityFile ~/.ssh/github ' >> ~/.ssh/config - View your public key
cat ~/.ssh/github.pub - Go to github.com and add your public key to your account
done.
Before you run any git commands, view your agents keys, and clear them.
ssh-add -l
ssh-add -D
Now run any git command that calls github, like git fetch, for example.
Then view your agents keys:
ssh-add -l
Clear, view, and add keys at will, just for fun.
-
Clear with
ssh-add -Doreval "$(ssh-agent -s)" -
Add with
ssh-add -K ~/.ssh/githuborgit fetch -
View with
ssh-add -l
- With
git fetchworking, delete your new entry in~/.ssh/config. Doesgit fetchstill work? - Run
ssh-add -D. How about now? - Add it back in, this time omitting the line with
AddKeysToAgent. Doesgit fetchwork? - Run
ssh-add -D. How about now?
- create a key with a passphrase
ssh-keygen -t ed25519 -C "has_password" -f ~/.ssh/augenand enter a password - ensure that ssh config calls for this key to use KeyChain
- Use the key (probably by adding the key to your github account and then running get fetch) and enter the password.
- Use the key again, note that you don't have to enter the password.
ssh-add -D, and delete the password from your keychain utility (a mac app)- Use again and note that now you need to reneter the key.