mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Caching Credentials as a git til.
This commit is contained in:
@@ -32,6 +32,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
|
||||
- [Accessing a Lost Commit](git/accessing-a-lost-commit.md)
|
||||
- [Amend Author Of Previous Commit](git/amend-author-of-previous-commit.md)
|
||||
- [Caching Credentials](git/caching-credentials.md)
|
||||
- [Checkout Old Version Of A File](git/checkout-old-version-of-a-file.md)
|
||||
- [Checkout Previous Branch](git/checkout-previous-branch.md)
|
||||
- [Clean Out All Local Branches](git/clean-out-all-local-branches.md)
|
||||
|
||||
23
git/caching-credentials.md
Normal file
23
git/caching-credentials.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Caching Credentials
|
||||
|
||||
When public key authentication isn't an option, you may find yourself typing
|
||||
your password over and over when pushing to and pulling from a remote git
|
||||
repository. This can get tedious. You can get around it, though, by
|
||||
configuring git to cache your credentials. Add the following lines to the
|
||||
`.git/config` file of the particular project.
|
||||
|
||||
```
|
||||
[credential]
|
||||
helper = cache --timeout=300
|
||||
```
|
||||
|
||||
This will tell git to cache your credentials for 5 minutes. Use a much
|
||||
larger number of seconds (e.g. 604800) to cache for longer.
|
||||
|
||||
Alternatively, you can execute the command from the command line like so:
|
||||
|
||||
```bash
|
||||
$ git config credential.helper 'cache --timeout=300'
|
||||
```
|
||||
|
||||
[source](http://git-scm.com/docs/git-credential-cache)
|
||||
Reference in New Issue
Block a user