gh icon indicating copy to clipboard operation
gh copied to clipboard

Use `git credential fill` to securely store token

Open cspotcode opened this issue 4 years ago • 0 comments

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.

cspotcode avatar Aug 03 '20 21:08 cspotcode