I recently created a second GitHub account two separate my work and my private projects (before, I only had the work account). I use https in combination with the Windows credential storage. To automatically select the correct account, I store my private account info in ~/.gitconfig and the work account info in ~/work/.gitconfig as suggested here.
Unfortunately, when I try to push changes in my private repositories, I get the following error:
$ git push remote: Permission to privateuser/privaterepo.git denied to workuser. fatal: unable to access 'https://email@example.com/privateuser/privaterepo.git/': The requested URL returned error: 403
I set the remote URL to git remote set-url origin https://firstname.lastname@example.org/privateuser/privaterepo.git like suggested here. Pushing in my work repos still works fine. And when I type git config user.name in my private/work repos, I get my private/work username, respectively - as it should be.
What’s the problem with the new private repositories? Why does git still think I’m workuser, when I try to push to my private repos? Does it have to do something with the Windows Credential storage, which I used to store my work credentials? It never asked for the password of my private account…
I tried to get help on stackoverflow, but it seems nobody can answer the question