mirror of
https://github.com/git/git.git
synced 2026-03-15 03:00:07 +01:00
This just does the normal "ask on the terminal, or use GIT_ASKPASS" logic that we already do. But it's useful for writers of third-party helpers. See the documentation for an example. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
59 lines
1.3 KiB
Plaintext
59 lines
1.3 KiB
Plaintext
git-credential-getpass(1)
|
|
=========================
|
|
|
|
NAME
|
|
----
|
|
git-credential-getpass - helper to request credentials from a user
|
|
|
|
SYNOPSIS
|
|
--------
|
|
[verse]
|
|
git credential-getpass
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
|
|
This command requests credentials from the user using git's "default"
|
|
scheme, including asking via the terminal and respecting the
|
|
`GIT_ASKPASS` environment variable; see linkgit:gitcredentials[7] for a
|
|
complete description. The helpers are provided on stdout using git's
|
|
credential helper protocol.
|
|
|
|
There is no point in using this program as a credential helper by
|
|
itself; it is exactly equivalent to git's behavior when no helper is
|
|
configured.
|
|
|
|
However, writers of third-party helpers may want to invoke this program
|
|
to simulate git's behavior.
|
|
|
|
EXAMPLES
|
|
--------
|
|
|
|
Here's a simple, silly example of a helper that stores credentials on
|
|
disk (similar to linkgit:git-credential-store[1]), and how it could use
|
|
the `getpass` helper.
|
|
|
|
-------------------------------------------
|
|
#!/bin/sh
|
|
|
|
STORAGE=$HOME/.credentials
|
|
|
|
for i in "$@"; do
|
|
case "$i" in
|
|
--unique=*)
|
|
unique=${i#--unique=} ;;
|
|
esac
|
|
done
|
|
|
|
if ! test -e "$STORAGE/$unique"; then
|
|
mkdir -m 0700 "$STORAGE"
|
|
git credential-getpass "$@" >"$STORAGE/$unique"
|
|
fi
|
|
|
|
cat "$STORAGE/$unique"
|
|
-------------------------------------------
|
|
|
|
GIT
|
|
---
|
|
Part of the linkgit:git[1] suite
|