-
Notifications
You must be signed in to change notification settings - Fork 0
Git Credentials
Cheng-Yu Hsu edited this page Sep 27, 2016
·
2 revisions
Git can store or cache your credentials so you don't need to type them every time.
There're few types of credential store/cache:
- Store them into a file
- Cache them into a file that will be destroyed after a period
- OS native keychain
Configure the credential helper using command line.
$ git config --global credential.helper [type][options]-
Store the credentials into a file:
Git will store your credentials in
~/.git-credentialsby default.$ git config --global credential.helper store
-
Cache the credentials into a file that will be destroyed after a period:
Git will store your credential in memory for 900 seconds by default.
$ git config --global credential.helper cache
You can also specify the timeout period using
--timeoutoption.$ git config --global credential.helper "cache --timeout=3600"Clear memory cache:
$ git credential-cache exit -
Store credentials in system keychain:
$ git config --global credential.helper osxkeychain
$ git config --global --unset credential.helper
$ git config --system --unset credential.helper
$ git config --local --unset credential.helper$ git credential-osxkeychain erase$ git credential-osxkeychain erase
> host=github.com
> protocol=httpsThis will clear password for https://github.com/*.