| 1 | git-credential-cache(1) |
| 2 | ======================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-credential-cache - Helper to temporarily store passwords in memory |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | ----------------------------- |
| 11 | git config credential.helper 'cache [<options>]' |
| 12 | ----------------------------- |
| 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | |
| 17 | This command caches credentials for use by future Git programs. |
| 18 | The stored credentials are kept in memory of the cache-daemon |
| 19 | process (instead of being written to a file) and are forgotten after a |
| 20 | configurable timeout. Credentials are forgotten sooner if the |
| 21 | cache-daemon dies, for example if the system restarts. The cache |
| 22 | is accessible over a Unix domain socket, restricted to the current |
| 23 | user by filesystem permissions. |
| 24 | |
| 25 | You probably don't want to invoke this command directly; it is meant to |
| 26 | be used as a credential helper by other parts of Git. See |
| 27 | linkgit:gitcredentials[7] or `EXAMPLES` below. |
| 28 | |
| 29 | OPTIONS |
| 30 | ------- |
| 31 | |
| 32 | --timeout <seconds>:: |
| 33 | |
| 34 | Number of seconds to cache credentials (default: 900). |
| 35 | |
| 36 | --socket <path>:: |
| 37 | |
| 38 | Use `<path>` to contact a running cache daemon (or start a new |
| 39 | cache daemon if one is not started). |
| 40 | Defaults to `$XDG_CACHE_HOME/git/credential/socket` unless |
| 41 | `~/.git-credential-cache/` exists in which case |
| 42 | `~/.git-credential-cache/socket` is used instead. |
| 43 | If your home directory is on a network-mounted filesystem, you |
| 44 | may need to change this to a local filesystem. You must specify |
| 45 | an absolute path. |
| 46 | |
| 47 | CONTROLLING THE DAEMON |
| 48 | ---------------------- |
| 49 | |
| 50 | If you would like the daemon to exit early, forgetting all cached |
| 51 | credentials before their timeout, you can issue an `exit` action: |
| 52 | |
| 53 | -------------------------------------- |
| 54 | git credential-cache exit |
| 55 | -------------------------------------- |
| 56 | |
| 57 | EXAMPLES |
| 58 | -------- |
| 59 | |
| 60 | The point of this helper is to reduce the number of times you must type |
| 61 | your username or password. For example: |
| 62 | |
| 63 | ------------------------------------ |
| 64 | $ git config credential.helper cache |
| 65 | $ git push http://example.com/repo.git |
| 66 | Username: <type your username> |
| 67 | Password: <type your password> |
| 68 | |
| 69 | [work for 5 more minutes] |
| 70 | $ git push http://example.com/repo.git |
| 71 | [your credentials are used automatically] |
| 72 | ------------------------------------ |
| 73 | |
| 74 | You can provide options via the credential.helper configuration |
| 75 | variable (this example increases the cache time to 1 hour): |
| 76 | |
| 77 | ------------------------------------------------------- |
| 78 | $ git config credential.helper 'cache --timeout=3600' |
| 79 | ------------------------------------------------------- |
| 80 | |
| 81 | PERSONAL ACCESS TOKENS |
| 82 | ---------------------- |
| 83 | |
| 84 | Some remotes accept personal access tokens, which are randomly |
| 85 | generated and hard to memorise. They typically have a lifetime of weeks |
| 86 | or months. |
| 87 | |
| 88 | git-credential-cache is inherently unsuitable for persistent storage of |
| 89 | personal access tokens. The credential will be forgotten after the cache |
| 90 | timeout. Even if you configure a long timeout, credentials will be |
| 91 | forgotten if the daemon dies. |
| 92 | |
| 93 | To avoid frequently regenerating personal access tokens, configure a |
| 94 | credential helper with persistent storage. Alternatively, configure an |
| 95 | OAuth credential helper to generate credentials automatically. See |
| 96 | linkgit:gitcredentials[7], sections "Available helpers" and "OAuth". |
| 97 | |
| 98 | GIT |
| 99 | --- |
| 100 | Part of the linkgit:git[1] suite |