node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

Use `git credential fill` to securely store token #778

Open cspotcode opened 4 years ago

cspotcode commented 4 years ago

Is your feature request related to a problem? Please describe.

I use a git access token stored in git's credential store for both git commands (pull, push) and for CLI scripts which talk to the github API. My scripts can extract the creds via git credential fill, and it's stored in my OS's keychain instead of plain text.

Describe the solution you'd like

some sort of configuration for gh so it can pull my access token from git credential fill

Describe alternatives you've considered

Additional context

This is how git credential fill works. Pipe a request in, it takes care of interactively prompting the user as needed, delegating to the OS-native credential helper. Then it writes a response to stdout.

echo 'url=https://github.com' | git credential fill

If node-gh wants to avoid conflicting with already-stored credentials, you could use a different form of URL. Or make this behavior an opt-in config flag so it doesn't affect everyone.