Post

How to save your git password in the Mac OSX keychain

Are you tired of constantly having to enter your Git password all the time? Here’s how to make life much easier for you by saving the git password in the Mac OSX keychain.

To stop Git from asking for your password on macOS, enable the osxkeychain credential helper. Check whether git credential-osxkeychain is available, install it if it is missing, then run git config --global credential.helper osxkeychain. Git will store your credentials in the macOS Keychain and reuse them automatically.

In order to not having enter your git based password every time you perform a git operation, here’s how you can store the git password in the Mac OSX keychain:

Check if you have the credential-osxkeychain helper already installed:

1
git credential-osxkeychain

If not, the download and install it:

1
2
3
curl http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain -o git-credential-osxkeychain
sudo mv git-credential-osxkeychain /usr/local/bin
sudo chmod u+x /usr/local/bin/git-credential-osxkeychain

And make git use the helper:

1
git config --global credential.helper osxkeychain
This post is licensed under CC BY 4.0 by the author.