1

I have a string (Github token) inside a file and I want this to be accessible via gitconfig only after I enter my keyring password.

For this I created a file /secret/token, and then chmod it to 400. Now I add an entry to git config,

git config --global ghi.token "!echo \"$(sudo cat /secret/ghi_token)\""

But this creates an entry with my token visible in plain text instead. What I want instead is to ask for my password each time a program tries to access this gitconfig entry.

  • 1
    Unsure if I understand your problem right, but what about replacing the first and last double quote with single quotes and removing the backslashes? – aventurin Sep 2 '16 at 20:08
  • 1
    @aventurin That didn't work. I got it working using pass though. – Araf Sep 3 '16 at 22:05
0

I accomplished this by using the pass password manager utility.

After adding the token in pass, I added the following entry in the .gitconfig:

[github]
    token = "!pass github/token"

The way pass works is by encrypting the passwords using a GPG key. So every time the token is accessed pass will ask you to enter the passphrase of your GPG key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.