diff --git a/README.md b/README.md index dcf968c..1495cc5 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/git/caching-credentials.md b/git/caching-credentials.md new file mode 100644 index 0000000..0213d3e --- /dev/null +++ b/git/caching-credentials.md @@ -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)