remote: Permission to MYUSERNAME/project.git denied to OLD-USER-NAME
I have 2 GitHub users. One for personal use and one for work use. MYUSERNAME will be my personal one for this example and OLD-USER-NAME the work one. I've stopped using OLD-USER-NAME a while ago but I'm getting the above error when trying to push to a github https. I solved the problem by pushing directly to https://[email protected]...
I'm trying to figure out why my OLD-USER-NAME was even mentioned and how git "knows about it".
Things I've tried:
ssh-add -l
->The agent has no identities.
- I couldn't find any .ssh folder.
- I don't have any ssh keys on both of my github accounts
git config --global --edit
orgit config --edit
shows MYUSERNAMEgit remote --verbose
which gave me:origin https://github.com/MYUSERNAME/project.git (fetch) origin https://github.com/MYUSERNAME/project.git (push)
- OLD-USER-NAME GitHub -> Settings -> Security History I can see my ip with a green dot next to it. Maybe it got something to do with it?
cd
to the.git
folder of the repository and rungrep -r OLD-USER-NAME .
? If that shows nothing, you can pretty much rule out anything on the local system. – PolitesseMYUSERNAME
I get a lot of results. If local system is out what else is there? – Verenagrep
command from within your home directory if you have time to wait around for it. That way it'll catch things like~/.gitconfig
,~/.ssh/config
, and so on. (So I was wrong to say that running it from the repository git directory eliminates anything on the local system.) Of course I see that you have already checked those, but just in case... – Politessestrace -e trace=file git ...
to see which files the command accesses and then focus on those, although I would do so with the understanding that it's unlikely to give the solution. – Politesse