Skip to content

Instantly share code, notes, and snippets.

Last active December 1, 2020 20:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Safe access for multiple user on the same account on a linux machine
First task is to create your own token (generate new token):
you can test it with
curl -u <token>:x-oauth-basic
Then write it down to a specific file in home/user/subuser/.netrc , where you just created your directory
content of the file:
login <githubUserName>
password <token>
protocol https
#Then encrypt it
gpg --gen-key
gpg --encrypt --armor --recipient .netrc
#then give it the right permission, and the right file extension
chmod 700 ./.netrc.asc
mv ./.netrc.asc ./.netrc.gpg
#Now, try to clone your repo:
git clone
give you token as password
#Inform it of your local configuration, so that next time you don't need to rewrite it:
git config --local credential.helper 'netrc -f /home/user/subuser/.netrc.gpg -d -v'
you might need to do download the perl script (see this gist) and make is executable and inside the current $PATH:
chmod +x ~/bin/credential-git-credential-netrc
Test with
gpg --decrypt /home/user/subuser/.netrc.gpg
cross check git config with
git config -e
git config --local githubUserName
git config --local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment