Reputation: 331
I am getting Permission to ORG/REPO denied to USER
just recently whenever I try and push commits to github, where USER
is not me! I can't even find that USER
anywhere in ~/.gitconfig or ~/.git-credentials.
I checked my ~/.ssh folder as well to double check if my keys got compromised. I even grepped for USER
everywhere to no avail.
Where is that coming from? Like I'd have expected USER
to be my account not someone else. I checked that USER
on github and they're one of the contributors in one repository that I contribute to. But I was pushing to a different repository they have no access to.
Upvotes: 1
Views: 36
Reputation: 1323065
where USER is not me
That points to an HTTPS URL, with the wrong credentials cached in it:
git config --global credential.helper
xxx
# replace xxx with the value returned by git config
printf "host=github.com\nprotocol=https"| git credential-xxx get
To remove the wrong user:
printf "host=github.com\nprotocol=https\nusername=WrongUser"| git credential-xxx erase
Upvotes: 1