Install the git credential-osxkeychain
Git supports pushing and pulling your Git repositories over both SSH and HTTPS. To work with a private repository over HTTPS, you must supply a username and password each time you push or pull. The git-credential-osxkeychain helper allows you to cache your username and password in the OSX keychain, so you don’t have to retype it each time.
- If you followed the MacPorts or Homebrew instructions here, the helper should already be installed. Otherwise you’ll need to download and install it. Open a terminal window and check:
git credential-osxkeychain usage: git credential-osxkeychain <get|store|erase></get|store|erase>
If you receive a usage statement, skip to step 4. If the helper is not installed, go to step 2.
- Use curl to download git-credential-osxkeychain (or download it via your browser) and move it to
$ curl -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain $ sudo mv git-credential-osxkeychain /usr/local/bin/
- Make the file an executable:
chmod u+x /usr/local/bin/git-credential-osxkeychain
- Configure git to use the osxkeychain credential helper.
$ git config --global credential.helper osxkeychain
The next time Git prompts you for a username and password, it will cache them in your keychain for future use.