Say you have a separate GitHub account for work. You want to look at your own private repositories, so you switch. Then its back to work, and you need to switch again.. Over and over. Thats the headache.
Auto GitHub Account Switcher saved me a lot of time here. I open a GitHub page, and the right account gets picked for me. You just have to tell it the rules once. So you wont land on that "404" page and suddenly get confused, because you were on the wrong account.
Doesnt GitHub already do this?
Partly. GitHub has had its own account switcher since November 2023. You click your profile picture, pick "Switch account", and your there. No need to log in again.
But you still do the picking. The GitHub docs dont describe any automatic switching.
That's the part I care about. Switching by hand is easy. Remembering to do it, every time, is the boring bit.
What the extension does
Simple: you tell it "in this GitHub repo, use this account". For example:
- Open your work repo
github.com/acme-co/app=> it uses your work account - Open your own private repo => it uses your personal account
You do this with a rule for the work repos, and set your personal one as the default account for everything else (sign-in pages are left alone). After that you just open the page.. no switching.
Want to switch by hand? One click in the extension popup or GitHub's avatar menu.
It's free and open source. It saves the login cookies for each account, and puts the right ones back when it switches.
Setting up a rule
A rule is a URL pattern plus an account. The pattern is a regular expression, which is just a way to describe what a link looks like.
Say your work organizations all start with acme-. The pattern can be:
^https://github\.com/acme- The ^https://github\.com/ part matters. A short pattern like /acme-.+? also matches github.com/someone/acme-tools, which is probaly not what you wanted.
Rules are checked from top to bottom and the first match wins. Not sure about one? Paste a link into Test a URL and it tells you which account will be used, and why. Very convenient.
Try it
- Download
chrome.zipfrom Releases and unzip it. - Open
chrome://extensions, turn on Developer mode, click Load unpacked and pick the folder. - Sign in to GitHub, then use Login Another Account in the popup for the second one.
- Add your rule in the Auto Switch Rules tab.
Good to know: it only works on github.com in the browser, not git push. It keeps your login cookies on your machine, not encrypted, so only install it if your ok with that.
Conclusion
GitHub's own switcher is fine if you dont mind picking. I wanted the picking done for me, and that is what saved me so much time.
Set up your rules once, test them, and then you can happily forget which account your on. The extension wont.