I have 2 github accounts, old and new. When I checkout a repo on the new, I cant commit it as it says my old github user is not authorised.
Lets say my old github account username is old, and email is old@old.com Lets say my new github account username is new, and email is new@new.com
The old github account has no SSH key associted with it. The new account has my ssh key. As I am using windows, ssh keys is something of a nightmare because putty/pagent uses ppk format, but openssh used by gitbash uses rsa. Some time ago, I managed to convert my ppk a rsa and put this in my windows users .ssh dir.
I have done this:
$ git config --global user.name new
$ git config --global user.email new@new.com
If I do this:
$ git config --global -l
or
$ git config -l
I see:
user.email=new@new.com
user.name=new
When I try to do $git push origin
remote: Permission to new/test.git denied to old.
fatal: unable to access 'https://github.com/new/test.git/':
403 user old not authorised
I get this error if I use gitbash, tortoise or VS code to do the push.
If I delete the cloned repo, and clone it again from scratch, then commit anything, same problem.
$ git clone git@github.com:new/test.git
Any idea why and where its getting the old user? There is no reference to the old github users anywhere on my machine, and its blocking me from being able to do any work.
There seems to be no way to delete the old user from github, but even if I could, it may still not solve the problem. I have not been able to work for months because I cant commit anything to github.
Another thing I tried was to edit the .git/config after cloning the repo. I tried changing the https to ssh url, as https has never worked for me in all the years using github. https allows you to clone, but never to push. If I checkout with ssh, using the right amount of vodoo, it used to work, but now its always getting the old user for no obvious reason.