blob: 71864a872642e85734d86f1c52479e7a22b1dfe0 [file] [log] [blame]
Jeff King71e1b4b2011-12-10 05:34:44 -05001git-credential-store(1)
2=======================
3
4NAME
5----
Jeff Kingc6632eb2012-08-08 14:34:49 -04006git-credential-store - Helper to store credentials on disk
Jeff King71e1b4b2011-12-10 05:34:44 -05007
8SYNOPSIS
9--------
10-------------------
Robert P. J. Dayde613052018-05-24 16:11:39 -040011git config credential.helper 'store [<options>]'
Jeff King71e1b4b2011-12-10 05:34:44 -050012-------------------
13
14DESCRIPTION
15-----------
16
17NOTE: Using this helper will store your passwords unencrypted on disk,
18protected only by filesystem permissions. If this is not an acceptable
19security tradeoff, try linkgit:git-credential-cache[1], or find a helper
20that integrates with secure storage provided by your operating system.
21
22This command stores credentials indefinitely on disk for use by future
Thomas Ackermann2de9b712013-01-21 20:17:53 +010023Git programs.
Jeff King71e1b4b2011-12-10 05:34:44 -050024
25You probably don't want to invoke this command directly; it is meant to
26be used as a credential helper by other parts of git. See
27linkgit:gitcredentials[7] or `EXAMPLES` below.
28
29OPTIONS
30-------
31
Jeff Kinge50cd672014-11-06 02:40:32 -050032--file=<path>::
Jeff King71e1b4b2011-12-10 05:34:44 -050033
Paul Tan44b22892015-03-24 13:20:28 +080034 Use `<path>` to lookup and store credentials. The file will have its
Jeff King71e1b4b2011-12-10 05:34:44 -050035 filesystem permissions set to prevent other users on the system
Elijah Newren89363522023-10-08 06:45:07 +000036 from reading it, but it will not be encrypted or otherwise
Paul Tan44b22892015-03-24 13:20:28 +080037 protected. If not specified, credentials will be searched for from
38 `~/.git-credentials` and `$XDG_CONFIG_HOME/git/credentials`, and
39 credentials will be written to `~/.git-credentials` if it exists, or
40 `$XDG_CONFIG_HOME/git/credentials` if it exists and the former does
41 not. See also <<FILES>>.
42
43[[FILES]]
44FILES
45-----
46
Matthieu Moybcf96262016-06-28 13:40:11 +020047If not set explicitly with `--file`, there are two files where
Paul Tan44b22892015-03-24 13:20:28 +080048git-credential-store will search for credentials in order of precedence:
49
50~/.git-credentials::
51 User-specific credentials file.
52
53$XDG_CONFIG_HOME/git/credentials::
54 Second user-specific credentials file. If '$XDG_CONFIG_HOME' is not set
55 or empty, `$HOME/.config/git/credentials` will be used. Any credentials
56 stored in this file will not be used if `~/.git-credentials` has a
57 matching credential as well. It is a good idea not to create this file
58 if you sometimes use older versions of Git that do not support it.
59
60For credential lookups, the files are read in the order given above, with the
61first matching credential found taking precedence over credentials found in
62files further down the list.
63
64Credential storage will by default write to the first existing file in the
65list. If none of these files exist, `~/.git-credentials` will be created and
66written to.
67
68When erasing credentials, matching credentials will be erased from all files.
Jeff King71e1b4b2011-12-10 05:34:44 -050069
70EXAMPLES
71--------
72
73The point of this helper is to reduce the number of times you must type
74your username or password. For example:
75
76------------------------------------------
77$ git config credential.helper store
78$ git push http://example.com/repo.git
79Username: <type your username>
80Password: <type your password>
81
82[several days later]
83$ git push http://example.com/repo.git
84[your credentials are used automatically]
85------------------------------------------
86
87STORAGE FORMAT
88--------------
89
90The `.git-credentials` file is stored in plaintext. Each credential is
91stored on its own line as a URL like:
92
93------------------------------
94https://user:pass@example.com
95------------------------------
96
Junio C Hamano20b49642020-04-28 11:15:15 -070097No other kinds of lines (e.g. empty lines or comment lines) are
98allowed in the file, even though some may be silently ignored. Do
99not view or edit the file with editors.
100
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100101When Git needs authentication for a particular URL context,
Jeff King71e1b4b2011-12-10 05:34:44 -0500102credential-store will consider that context a pattern to match against
103each entry in the credentials file. If the protocol, hostname, and
104username (if we already have one) match, then the password is returned
Thomas Ackermann2de9b712013-01-21 20:17:53 +0100105to Git. See the discussion of configuration in linkgit:gitcredentials[7]
Jeff King71e1b4b2011-12-10 05:34:44 -0500106for more information.
107
108GIT
109---
110Part of the linkgit:git[1] suite