Since git 1.8.3 (May, 2013), you now can specify an encrypted .netrc
for git to use:
A new read-only credential helper (in contrib/credential/netrc/
) to interact with the .netrc/.authinfo
files has been added.
That script would allow you to use gpg-encrypted netrc files, avoiding the issue of having your credentials stored in a plain text file.
-f|--file AUTHFILE
specify netrc-style files.
Files with the .gpg
extension will be decrypted by GPG before parsing.
Multiple -f
arguments are OK. They are processed in order, and the first matching entry found is returned via the credential helper protocol (see below).
When no -f
option is given, .authinfo.gpg
, .netrc.gpg
, .authinfo
, and .netrc
files in your home directory are used in this order.
To enable this credential helper:
git config credential.helper '$shortname -f AUTHFILE1 -f AUTHFILE2'
(Note that Git will prepend "git-credential-
" to the helper name and look for it
in the path.)
See a complete step-by-step example at:
"Is there a way to skip password typing when using https://github.com
".