Skip to content

@technoweenie /gist:1072829
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
.netrc file so you can push/pull to https git repos without entering your creds all the time
machine github.com
login technoweenie
password SECRET
machine api.github.com
login technoweenie
password SECRET
@technoweenie
Owner

Stick this in ~/.netrc with chmod 600 or something. You can curl the api as yourself with curl -n https://api.github.com/user

@noamtm

What about per-repository login?

@g2p

@noamtm I just checked, netrc or gitcredentials aren't up to the task (the latter has an option to match on host paths, but prefix matches are missing so it's only semi-convenient). If you control the url you should put the username in the url or use host aliases, both ssh (man ssh_config) and git (git help config then /insteadof) have them; if you can't (go get or pip remote requirements), there is no convenient solution.

@madarche

Note about a limitation: password in .netrc file should not contain spaces, since the .netrc file is parsed against spaces, tabs and new-lines.

@soupdiver

Thanks man! Exactly what I needed

@kprikshit

Any way to store password here not in plain text.
It's too risky to store in plaintext

@snowyu

github supports the access token instead of password: https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.