Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set up the gist gem, but I don't want to have my GitHub password stored as an environment variable or git config item. The README from the GitHub repo explains,

You can also define github.password to be a command which returns the actual password on stdout by setting the variable to a command string prefixed with !.

The problem I'm having is figuring out where to put the described function. Any tips?

Here's the function described in the above link (fetches github.password item from Mac OS Keychain):

password = !security 2>&1 >/dev/null find-generic-password -gs github.password | ruby -e 'print $1 if STDIN.gets =~ /^password: \\\"(.*)\\\"$/'
share|improve this question
    
Is this the best forum for this question or would it be better on another SE site? If so, how can I move it? –  jcaudle May 28 '12 at 16:32
add comment

1 Answer

up vote 0 down vote accepted

This line belongs in $HOME/.gitconfig in the github section. Shell escaping and such will make life difficult, so if $HOME/.gitconfig does not exist or if it does not have an github section, create it with

git config --global github.password foo

That will create the file if necessary with the correct formatting and add a line

password = foo

Edit the file and replace password = foo with that recommended on github.

share|improve this answer
    
So it should go in as an alias rather than under the github heading as recommended in the README? –  jcaudle May 28 '12 at 20:01
    
Shouldn’t that be alias.github.password? –  kopischke May 28 '12 at 20:54
    
@kopischke You are probably right and github.password is correct. –  William Pursell May 29 '12 at 1:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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