[pass] Using pass with git config core.askpass
Quentin Minster
quentin at minster.io
Wed Nov 19 22:37:28 CET 2014
On Tue, Nov 18, 2014 at 10:41:00PM +0100, Alexander Baier wrote:
> Hello,
>
> I would like to use pass to supply git with login information when
> accessing a remote repository (e.g. on github). I put the following
> section into my ~/.gitconfig:
>
> [core]
> askpass = pass show Code/github.com
>
> Doing 'git push' will now print
>
> "error: cannot run 'pass show Code/github.com': No such file or
> directory"
>
> and will continue with prompting me for my username and password:
>
> Username for 'https://github.com':
> Password for 'https://user@github.com'
>
> Does anyone know how I can tell git to use pass for retrieving my
> credentials?
>
> Regards,
> --
> Alexander Baier
>
Hello,
I use a git credential helper [1] for this (attached).
It must be located in your path for git to find and use it (and the name
'git-credential-pass' is actually important).
Then you can use the following configuration in your .git/config:
[credential]
helper = pass Code/github.com
Hope this helps.
Regards,
--
Quentin Minster
GPG Public Key : 0F5F912C
GPG Fingerprint : AA09 29D0 263B E9D6 C260 BDC5 FF79 BF27 0F5F 912C
[1]: http://git-scm.com/docs/gitcredentials
-------------- next part --------------
#!/bin/sh
# git provides additional information on stdin,
# in the following format:
#protocol=<protocol>
#host=<host>
#user=<user>
STDIN="$(cat)"
if [ "$2" = "get" ]
then
echo -n "password="
pass "$1" | head -n1
exit $?
fi
exit 1
More information about the Password-Store
mailing list