Git Bash still pushes repo with old Username

So, I am attempting to push my github repository to github. However, I changed usernames a little while back, and it still thinks that I am pushing with my old username. I have tried the following commands.

git config --global

git config --global

git config --unset --global

git config --unset --global

git config --unset

git config --unset

git remote rm origin

git remote set-url origin

git config "CorrectUsername"

git config "CorrectEmail"

git config --global "CorrectUsername"

git config --global "CorrectUsername@correctdomain"

git config --list

After this, I still obtain a 403 error saying that my old username failed to push the repo:

git push origin master

remote: Permission to CorrectUsername/CorrectRepo.git denied to OldUsername.
fatal: unable to access '': The requested URL
returned error: 403

How can I get Github to use the new username that I put in?


What do you see when you are in your repo that gives you the error and you type the following command?

git config --list | grep

I have the same problem

Using that following command returns new username but it still remember old username somehow

1 Like

Did u find the solution, i also having the same problem

Same problem here. Is there any solition?

Solution 1.


git config credential.username "new_username"


git config --global credential.username  "new_username"

Solution 2. (In case solution 1 doesn’t work):

git remote set-url origin "" 

Thank you so much…you saved my day.

1 Like

After all these suggestions I still can’t commit to my own repo’s with my new account, still shows my old account as the contributor T.T

Really thanks. It worked for me.

did you try uninstalling git bash? and restarting the computer?

I solved this by going to my Windows’s Credential Manager and delete the old github credentials stored on computer. You can try and see if it works.

1 Like

this solution worked for me