1GIT-CREDENTIAL-STO(1) Git Manual GIT-CREDENTIAL-STO(1)
2
3
4
6 git-credential-store - Helper to store credentials on disk
7
9 git config credential.helper 'store [<options>]'
10
12 Note
13 Using this helper will store your passwords unencrypted on disk,
14 protected only by filesystem permissions. If this is not an
15 acceptable security tradeoff, try git-credential-cache(1), or find
16 a helper that integrates with secure storage provided by your
17 operating system.
18
19 This command stores credentials indefinitely on disk for use by future
20 Git programs.
21
22 You probably don’t want to invoke this command directly; it is meant to
23 be used as a credential helper by other parts of git. See
24 gitcredentials(7) or EXAMPLES below.
25
27 --file=<path>
28 Use <path> to lookup and store credentials. The file will have its
29 filesystem permissions set to prevent other users on the system
30 from reading it, but will not be encrypted or otherwise protected.
31 If not specified, credentials will be searched for from
32 ~/.git-credentials and $XDG_CONFIG_HOME/git/credentials, and
33 credentials will be written to ~/.git-credentials if it exists, or
34 $XDG_CONFIG_HOME/git/credentials if it exists and the former does
35 not. See also the section called “FILES”.
36
38 If not set explicitly with --file, there are two files where
39 git-credential-store will search for credentials in order of
40 precedence:
41
42 ~/.git-credentials
43 User-specific credentials file.
44
45 $XDG_CONFIG_HOME/git/credentials
46 Second user-specific credentials file. If $XDG_CONFIG_HOME is not
47 set or empty, $HOME/.config/git/credentials will be used. Any
48 credentials stored in this file will not be used if
49 ~/.git-credentials has a matching credential as well. It is a good
50 idea not to create this file if you sometimes use older versions of
51 Git that do not support it.
52
53 For credential lookups, the files are read in the order given above,
54 with the first matching credential found taking precedence over
55 credentials found in files further down the list.
56
57 Credential storage will by default write to the first existing file in
58 the list. If none of these files exist, ~/.git-credentials will be
59 created and written to.
60
61 When erasing credentials, matching credentials will be erased from all
62 files.
63
65 The point of this helper is to reduce the number of times you must type
66 your username or password. For example:
67
68 $ git config credential.helper store
69 $ git push http://example.com/repo.git
70 Username: <type your username>
71 Password: <type your password>
72
73 [several days later]
74 $ git push http://example.com/repo.git
75 [your credentials are used automatically]
76
78 The .git-credentials file is stored in plaintext. Each credential is
79 stored on its own line as a URL like:
80
81 https://user:pass@example.com
82
83 No other kinds of lines (e.g. empty lines or comment lines) are allowed
84 in the file, even though some may be silently ignored. Do not view or
85 edit the file with editors.
86
87 When Git needs authentication for a particular URL context,
88 credential-store will consider that context a pattern to match against
89 each entry in the credentials file. If the protocol, hostname, and
90 username (if we already have one) match, then the password is returned
91 to Git. See the discussion of configuration in gitcredentials(7) for
92 more information.
93
95 Part of the git(1) suite
96
97
98
99Git 2.39.1 2023-01-13 GIT-CREDENTIAL-STO(1)