IssueRaiser

Allow multiple account credentials

### Describe the feature or problem you’d like to solve I have two accounts on github each with access to a different set of private repositories. Currently I use a combination of git's `[IncludeIf ...]` config and a custom config which overrides the SSH private key I use for certain repositories. E.g.: In `~/.gitconfig`: ``` [includeIf "gitdir:~/work/"] path = ~/work/.gitconfig ``` and in `~/work/.gitconfig`: ``` [core] sshCommand = "ssh -i ~/.ssh/work" ``` It will be great if the credentials for `gh` can also be configured per repository as well. ### Proposed solution There are a bunch of options I can think of: * Allow overriding `gh` config by a file in a local clone's `.git` directory * Allow defining rules in the `gh` config which defines which repos/orgs should use which credential. E.g. ``` github.com/google: - user: gemployee oauth_token: ... github.com/microsoft: - user: msemployee oauth_token: ... github.com: - user: personal oauth_token: ... ``` **How will it benefit CLI and its users?** It will allow Github users with multiple accounts of varying access to seamlessly work on different repositories.

Posted by ncmans on Feb 7, 2020, 4:29 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (Software)

Allow multiple account credentials

ncmansFeb 7, 2020, 4:29 AM

### Describe the feature or problem you’d like to solve I have two accounts on github each with access to a different set of private repositories. Currently I use a combination of git's `[IncludeIf ...]` config and a custom config which overrides the SSH private key I use for certain repositories. E.g.: In `~/.gitconfig`: ``` [includeIf "gitdir:~/work/"] path = ~/work/.gitconfig ``` and in `~/work/.gitconfig`: ``` [core] sshCommand = "ssh -i ~/.ssh/work" ``` It will be great if the credentials for `gh` can also be configured per repository as well. ### Proposed solution There are a bunch of options I can think of: * Allow overriding `gh` config by a file in a local clone's `.git` directory * Allow defining rules in the `gh` config which defines which repos/orgs should use which credential. E.g. ``` github.com/google: - user: gemployee oauth_token: ... github.com/microsoft: - user: msemployee oauth_token: ... github.com: - user: personal oauth_token: ... ``` **How will it benefit CLI and its users?** It will allow Github users with multiple accounts of varying access to seamlessly work on different repositories.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue