- 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/config
echo ' 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 -D
oreval "$(ssh-agent -s)"
-
Add with
ssh-add -K ~/.ssh/github
orgit fetch
-
View with
ssh-add -l
- With
git fetch
working, delete your new entry in~/.ssh/config
. Doesgit fetch
still work? - Run
ssh-add -D
. How about now? - Add it back in, this time omitting the line with
AddKeysToAgent
. Doesgit fetch
work? - Run
ssh-add -D
. How about now?
- create a key with a passphrase
ssh-keygen -t ed25519 -C "has_password" -f ~/.ssh/augen
and 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.