Switching GitHub accounts in seconds

Switching GitHub accounts in seconds

Do you toggle between a personal account and an Upwork account? There’s no need to log out and go through the entire setup process every single time.

To switch to the account you want, use:

gh auth switch --user fac

Replace fac with upwork, depending on which account you wish to use.

To add a second account, run:

gh auth login

Log in via your browser and authorize access for that other GitHub account.

To check which account is currently active:

gh auth status

For a long time, I assumed that switching between two accounts meant having to redo the entire login process. In reality, a few simple commands are all it takes—a great reminder that a small tweak to your workflow can save you time every single day.

image.png