Skip to content

Commit

Permalink
Add option to retrieve oauthtoken from a password store
Browse files Browse the repository at this point in the history
  • Loading branch information
eonpatapon authored and Daniel Zullo committed Oct 30, 2020
1 parent 00561d7 commit 1bc119e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions git-hub
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ class Config:
def __init__(self):
self.username = git_config('username', getpass.getuser())
self.oauthtoken = git_config('oauthtoken')
self.oauthtokencmd = git_config('oauthtokencmd')
if self.oauthtokencmd is not None:
try:
self.oauthtoken = subprocess.check_output(
self.oauthtokencmd, shell=True).strip()
except (OSError, subprocess.CalledProcessError) as e:
die("Failed to run oauthtokencmd `{}`: {}",
self.oauthtokencmd, e)
self.upstream = git_config('upstream')
if self.upstream and '/' not in self.upstream:
die("Invalid hub.upstream configuration, '/' not found")
Expand Down
4 changes: 4 additions & 0 deletions man.rst
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ from. These are the git config keys used:
required, you shouldn't need to set this variable manually. Use the `setup`
command instead.

`hub.oauthtokencmd`
A command to retrieve the oauth token from a password store.
When set, `hub.oauthtoken` isn't needed.

`hub.upstream` required
Blessed repository used to get the issues from and make the pull requests to.
The format is *<owner>/<project>*. This option can be automatically set by
Expand Down

0 comments on commit 1bc119e

Please sign in to comment.