Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git thinks I am someone else

Tags:

git

github

Suddenly git thinks I am someone else. The person it thinks I am is someone I work with, but I cannot find any reference as to why git thinks this. I have check system level, local, and global level git configs, I have checked my ssh keys, not sure what else to check. Maybe I should uninstall git? Error is below.

remote: Permission to myusername/mitty.git denied to personiworkwith.
fatal: unable to access 'https://github.com/myusername/mitty.git/': The requested URL returned error: 403
like image 905
Seal Avatar asked Oct 20 '25 17:10

Seal


2 Answers

unable to access 'https

That means it has nothing to do with ssh and ssh keys: it is an https url.

See what git remote -v returns, but if it is https, and if you have a credential helper (see git config -l | grep credential), that would explain why the wrong set of credential is used.

Try at least to force the right username with

cd /patH/to/my/repo
git remote set-url origin https://<myusername>@github.com/myusername/mitty.git

Or, of course, try and use ssh if you want:

git remote set-url origin [email protected]:myusername/mitty.git
like image 79
VonC Avatar answered Oct 22 '25 07:10

VonC


If you're having this issue, you're probably on Windows using a Credential Manager like me. If so:

Credential Manager has your old co-worker cached, here's how to remove them. https://support.microsoft.com/en-us/search?query=credential%20manager

For Windows 10: Control Panel > Credentials Manager, select Windows Credentials, look for github.com ( ex: git:https://github.com ), click the arrow to options/details, Remove

Now the next time you try to access remote ( ex: pushing to a new repo:)

git push -u origin master

etc... it will ask for your git creds. And should save them for next time.

like image 41
user11064470 Avatar answered Oct 22 '25 05:10

user11064470



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!