Merge branch 'jc/maint-combined-diff-work-tree' into next
[git] / Documentation / git-credential-getpass.txt
1 git-credential-getpass(1)
2 =========================
3
4 NAME
5 ----
6 git-credential-getpass - helper to request credentials from a user
7
8 SYNOPSIS
9 --------
10 [verse]
11 git credential-getpass
12
13 DESCRIPTION
14 -----------
15
16 This command requests credentials from the user using git's "default"
17 scheme, including asking via the terminal and respecting the
18 `GIT_ASKPASS` environment variable; see linkgit:gitcredentials[7] for a
19 complete description. The helpers are provided on stdout using git's
20 credential helper protocol.
21
22 There is no point in using this program as a credential helper by
23 itself; it is exactly equivalent to git's behavior when no helper is
24 configured.
25
26 However, writers of third-party helpers may want to invoke this program
27 to simulate git's behavior.
28
29 EXAMPLES
30 --------
31
32 Here's a simple, silly example of a helper that stores credentials on
33 disk (similar to linkgit:git-credential-store[1]), and how it could use
34 the `getpass` helper.
35
36 -------------------------------------------
37 #!/bin/sh
38
39 STORAGE=$HOME/.credentials
40
41 for i in "$@"; do
42         case "$i" in
43         --unique=*)
44                 unique=${i#--unique=} ;;
45         esac
46 done
47
48 if ! test -e "$STORAGE/$unique"; then
49         mkdir -m 0700 "$STORAGE"
50         git credential-getpass "$@" >"$STORAGE/$unique"
51 fi
52
53 cat "$STORAGE/$unique"
54 -------------------------------------------
55
56 GIT
57 ---
58 Part of the linkgit:git[1] suite