I have two GitHub accounts. First is main, second is for some tests (I'm new in git). In my C:\Users\<Username>\.gitconfig
file I have user name and email similar to main GitHub account. Now I've created local repository and change its .git\config
file with username and email similar to my second account. But still when I push, it tries to push as user of main account and I have this error:
Permission to <2nd username>/test.git denied to <1st username>.
I thought that only email address is a way how git and GitHub are bounded, and that .git\config
will override C:\Users\<Username>\.gitconfig
for that repository.
But it seems that I'm wrong...
UPD:
As I remember in my very first push to GitHub git opened a window where I was needed to enter login and password of GitHub. And I entered main account login and paswsword. I have expected that this window opened again, after i tryed to push with new email...