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.

2
  • 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
    Commented Sep 2, 2016 at 20:08
  • 1
    @aventurin That didn't work. I got it working using pass though.
    – Araf
    Commented Sep 3, 2016 at 22:05

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .