gitwindows-10github-cli

Switch user in GitHub CLI


I am using GitHub CLI and MinGit for Windows.

When I logout of GitHub CLI with gh auth logout and log back in with different account by calling gh auth login git config does not change.

When I type git config --global --list the user.name and user.email entries still point to the old account. So when I commit, it looks like the commit was made by my old account.

I know I could type git config --global user.name "username" and change the name but how can I do this correctly with GitHub CLI?

If I cannot do this with GitHub CLI are user.name and user.email the only two entries I need to change to commit as my new account?


Solution

  • A new command has been added. You can use the following

    gh auth switch
    

    For further information you may check this out https://cli.github.com/manual/gh_auth_switch