@eXamadeus GitHub CLI currently has no mechanism for switching between multiple GitHub accounts and I don't really have a workaround to suggest for you at this moment, sorry. #91
@eXamadeus GitHub CLI currently has no mechanism for switching between multiple GitHub accounts and I don't really have a workaround to suggest for you at this moment, sorry.
The only approach I could imagine, but would not recommend to anyone, would be to authenticate with 1st account, save a copy of ~/.config/gh/hosts.yml somewhere & delete the original file, authenticate again with the 2nd account, and now you can swap the ~/.config/gh/hosts.yml file with the backup file when you need to switch accounts.
Since this solution involves using SSH for git protocol, make sure both configuration files include the git_protocol: ssh line.
The only approach I could imagine, but would not recommend to anyone, would be to authenticate with 1st account, save a copy of
~/.config/gh/hosts.yml
somewhere & delete the original file, authenticate again with the 2nd account, and now you can swap the~/.config/gh/hosts.yml
file with the backup file when you need to switch accounts.Since this solution involves using SSH for git protocol, make sure both configuration files include the
git_protocol: ssh
line.Originally posted by @mislav in https://github.com/cli/cli/issues/326#issuecomment-623440757