other versions
- wheezy 1:1.7.10.4-1+wheezy3
- wheezy-backports 1:1.9.1-1~bpo70+2
- jessie 1:2.1.4-2.1+deb8u2
- jessie-backports 1:2.11.0-3~bpo8+1
- testing 1:2.11.0-3
- unstable 1:2.11.0-4
- experimental 1:2.13.1+next.20170610-1
GITCREDENTIALS(7) | Git Manual | GITCREDENTIALS(7) |
NAME¶
gitcredentials - providing usernames and passwords to gitSYNOPSIS¶
git config credential.https://example.com.username myusername git config credential.helper "$helper $options"
DESCRIPTION¶
Git will sometimes need credentials from the user in order to perform operations; for example, it may need to ask for a username and password in order to access a remote repository over HTTP. This manual describes the mechanisms git uses to request these credentials, as well as some features to avoid inputting these credentials repeatedly.REQUESTING CREDENTIALS¶
Without any credential helpers defined, git will try the following strategies to ask the user for usernames and passwords: 1.If the GIT_ASKPASS environment variable is
set, the program specified by the variable is invoked. A suitable prompt is
provided to the program on the command line, and the user’s input is
read from its standard output.
2.Otherwise, if the core.askpass
configuration variable is set, its value is used as above.
3.Otherwise, if the SSH_ASKPASS environment
variable is set, its value is used as above.
4.Otherwise, the user is prompted on the
terminal.
AVOIDING REPETITION¶
It can be cumbersome to input the same credentials over and over. Git provides two methods to reduce this annoyance: 1.Static configuration of usernames for a
given authentication context.
2.Credential helpers to cache or store
passwords, or to interact with a system password wallet or keychain.
[credential "https://example.com"] username = me
Cache credentials in memory for a short period
of time. See git-credential-cache(1) for details.
store
Store credentials indefinitely on disk. See
git-credential-store(1) for details.
1.Find a helper.
$ git help -a | grep credential- credential-foo
2.Read its description.
$ git help credential-foo
3.Tell git to use it.
$ git config --global credential.helper foo
CREDENTIAL CONTEXTS¶
Git considers each credential to have a context defined by a URL. This context is used to look up context-specific configuration, and is passed to any helpers, which may use it as an index into secure storage.[credential "https://example.com"] username = foo
[credential "https://kernel.org"] username = foo
CONFIGURATION OPTIONS¶
Options for a credential context can be configured either in credential.* (which applies to all credentials), or credential.<url>.*, where <url> matches the context as described above.The name of an external credential helper, and
any associated options. If the helper name is not an absolute path, then the
string git credential- is prepended. The resulting string is executed by the
shell (so, for example, setting this to foo --option=bar will execute git
credential-foo --option=bar via the shell. See the manual of specific helpers
for examples of their use.
username
A default username, if one is not provided in
the URL.
useHttpPath
By default, git does not consider the
"path" component of an http URL to be worth matching via external
helpers. This means that a credential stored for https://example.com/foo.git
will also be used for https://example.com/bar.git. If you do want to
distinguish these cases, set this option to true.
CUSTOM HELPERS¶
You can write your own custom helpers to interface with any system in which you keep credentials. See the documentation for git’s credentials API[1] for details.GIT¶
Part of the git(1) suiteNOTES¶
- 1.
- credentials API
03/19/2016 | Git 1.7.10.4 |