Skip to content

Instantly share code, notes, and snippets.

@ashish-ad
Last active June 24, 2022 04:34
Show Gist options
  • Save ashish-ad/5f7da1525b0bcad09bb3414aed0177cb to your computer and use it in GitHub Desktop.
Save ashish-ad/5f7da1525b0bcad09bb3414aed0177cb to your computer and use it in GitHub Desktop.
Commands for configuring git when using SSH in git and saving git ssh keygen to system

Configuring credential.helper

On OS X (now macOS), run this in terminal:

git config --global credential.helper osxkeychain

It enables Git to use file Keychain.app to store username and password and to retrieve the passphrase to your private SSH key from the keychain.

For Windows use:

git config --global credential.helper manager-core

For Linux use:

git config --global credential.helper cache #If you want to cache the credentials for some time (default 15 minutes)

OR

git config --global credential.helper store #if you want to store the credentials for ever (considered unsafe)

Troubleshooting

If the GIT credential helper is configured correctly macOS saves the passphrase in the keychain. Sometimes the conneciton between the SSH and the passphrases stored int the keychain can break. Run ssh-add -K OR ssh-add ~/.ssh/id_rsa to add the keychain again.

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