Question

I've started experimenting with git and github. I've created a respository and I'm trying to publish. I get an error that looks something like this:

$ git push origin master

ERROR: Permission to myuser/MyProject.git denied to OldAccount.
fatal: could not read from remote repository

Please make sure you have the correct access rights and the repository exists

What surprised me was that git thought I was OldAccount. That was a user name I created over a year ago during my first experiment with git. I decided today to create a new account and I'm trying to use my new account, but git keeps trying to publish using my old account. I'm using the GitHub for Windows application and it's definitely logged in to my new account. So how is OldAccount still popping up?

Was it helpful?

Solution

Check also your git config user.email:

The email must be the one associated with your new account, not your old one.
(That is illustrated by a recent answer at "Git commits associated with old, defunct user instead of the user I have now")

And regarding the push, make sure your url isn't an https one with your old login in it:

htps://OldLogin@github.com/newLogin/newRepo

(type git remote -v to see the 'origin' url)

If it uses an ssh url, then as mentioned, check your public key:

OTHER TIPS

I think you have your public SSH key still added to your old account.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top