Skip to content

Instantly share code, notes, and snippets.

@soardex
Created June 24, 2015 06:34
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soardex/bd588f633d03d8bd0f84 to your computer and use it in GitHub Desktop.
Save soardex/bd588f633d03d8bd0f84 to your computer and use it in GitHub Desktop.
Encrypted .netrc for Git
# encrypt ~/.netrc with gpg agent
gpg -e -r [your_gpg_id] ~/.netrc
# clean removed .netrc file
shred ~/.netrc
rm -f ~/.netrc
# enable credential helper
# this would search files in your home directory
# .authinfo.gpg
# .netrc.gpg
# .authinfo
# .netrc
git config --global credential.helper /usr/share/git/credential/netrc/git-credential-netrc
# committing files to server
echo "secret_password" | gpg push -u origin master
@wpcarro
Copy link

wpcarro commented Apr 1, 2018

Thanks for sharing this. Is this supposed to be git push instead of gpg push?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment