Skip to content

Instantly share code, notes, and snippets.

@jasoncarr95
Last active January 27, 2023 23:39
Show Gist options
  • Save jasoncarr95/4e6abd0541aa41e348542bb382f59a0e to your computer and use it in GitHub Desktop.
Save jasoncarr95/4e6abd0541aa41e348542bb382f59a0e to your computer and use it in GitHub Desktop.
How to cache your ssh key in the macOS keychain

How to cache your ssh key in the macOS keychain

ssh-add --apple-use-keychain ~/.ssh/id_ed25519

Test

To test that it worked, run ssh-add -L and you should see your key listed.

Also to test your connection to GitHub, run ssh -T [email protected] and you should see a message like this:

Hi <user> You've successfully authenticated, but GitHub does not provide shell access.

Why?

I kept getting prompted for my password every time I pushed to a remote repository, or used GitHub CLI tools like gh clone <repo>.

You can cache your ssh key in the macOS keychain to avoid having to enter your password every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment