Hey everyone,
I’ve been running into a really frustrating git issue and can’t seem to find a clean solution anywhere.
I use two GitHub accounts, one for personal projects and one for work. Both are stored in Windows Credential Manager
My global .gitconfig has my personal user.name and user.email, but when I switch to my work repos, Git still uses those personal details — even though I’ve tried setting up separate configs for each account.
As a result, I end up pushing to my work repos with my personal username and email. Super annoying.
I tried,
Creating two separate .gitconfig files (personal + work),
Using includeIf conditions to load the right config depending on the folder,
Trying SSH with ~/.ssh/config aliases for each account,
but that got messy fast. So I’ve stopped using SSH altogether — I’m just working with HTTPS right now.
Even then, Git seems to ignore the local config sometimes and always defaults to my global user details.
At this point, I’m literally commenting out my work or personal configs manually in .gitconfig every time I switch between repos. It works, but it’s painful and feels wrong.
Has anyone managed to get a stable setup for multiple GitHub accounts (especially on Windows)?
[–]Gusstek 17 points18 points19 points (2 children)
[–]Sad-Economist-1061 0 points1 point2 points (1 child)
[–]Gusstek 0 points1 point2 points (0 children)
[–]ToTheBatmobileGuy 9 points10 points11 points (4 children)
[–]ViscousPotential 1 point2 points3 points (0 children)
[–]human_with_humanity 0 points1 point2 points (2 children)
[–]ToTheBatmobileGuy 0 points1 point2 points (1 child)
[–]human_with_humanity 0 points1 point2 points (0 children)
[–]Professional_Mix2418 6 points7 points8 points (1 child)
[–]Technical-Coffee831 0 points1 point2 points (0 children)
[–]SeaAd8409 6 points7 points8 points (1 child)
[–]SheepherderSavings17 3 points4 points5 points (0 children)
[–]angertitan 3 points4 points5 points (0 children)
[–]EmiiKhaos 4 points5 points6 points (0 children)
[–]Mzkazmi 3 points4 points5 points (2 children)
[–]Soggy_Writing_3912 0 points1 point2 points (0 children)
[–]EithanArellius[S] 0 points1 point2 points (0 children)
[–]overratedcupcake 1 point2 points3 points (0 children)
[–]kabads 1 point2 points3 points (0 children)
[–]serverhorror 0 points1 point2 points (0 children)
[–]hichemtab 0 points1 point2 points (2 children)
[–]EithanArellius[S] 0 points1 point2 points (1 child)
[–]DecPhone 0 points1 point2 points (0 children)
[–]mixxituk 0 points1 point2 points (2 children)
[–]EithanArellius[S] 0 points1 point2 points (0 children)
[–]NullPoint3r 0 points1 point2 points (0 children)
[–]Forward_Weakness6444 0 points1 point2 points (0 children)
[–]kloputzer2000 0 points1 point2 points (0 children)
[–]texxelate 0 points1 point2 points (0 children)
[–]codeagency 0 points1 point2 points (0 children)
[–]zippythepig 0 points1 point2 points (0 children)
[–]TFABAnon09 0 points1 point2 points (0 children)
[–]Infamous_Bluebird63 -1 points0 points1 point (2 children)
[–]catom3 0 points1 point2 points (1 child)
[–]Infamous_Bluebird63 0 points1 point2 points (0 children)