Skip to content

Instantly share code, notes, and snippets.

@brenopacheco
Last active Mar 31, 2021
Embed
What would you like to do?
storing git credentials with gpg and .netrc

storing git credentials with gpg and .netrc

  1. set up git credential helper in .gitconfig
    [credential]
        helper = /usr/share/git/credential/netrc/git-credential-netrc.perl
  1. add login configuration to .netrc
    machine github.com
      login <email (or username?)>
      password <password>
      protocol https
    machine bitbucket.org
      login <username (not email!)>
      password <password>
      protocol https
  1. encrypt .netrc (output MUST be .netrc.gpg otherwise helper won't decrypt)
    gpg -ea --output .netrc.gpg .netrc
    shred .netrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment