问题
I'm setting up a new git repository for a coding challenge that was sent to me by a prospective employer. I'm using a new computer (Mac OSX); however, when I try to push my existing repository from the command line using HTTPS, I get an error message saying:
remote: Permission to afriedman1991/PS_Change_Log_Notifier.git denied to scratchbenchmark.
fatal: unable to access 'https://github.com/afriedman1991/PS_Change_Log_Notifier.git/': The requested URL returned error: 403
Benchmark was the company I used to work for, who used SSH to manage their project. For some reason, git thinks I'm still trying to push to their repository, even though my origin is set to:
origin https://github.com/afriedman1991/PS_Change_Log_Notifier.git (fetch)
origin https://github.com/afriedman1991/PS_Change_Log_Notifier.git (push)
I've been trying to figure out how to fix this for a while now, but can't seem to find any solutions that work. Can anyone help?
回答1:
Check if your credential helper has cached the wrong credentials
git config credential.helper
If it is "manager", you can "sign out in the Git Bash console in Windows".
git credential-manager reject https://github.com
On Mac, for osxkeychain, see "Updating credentials from the OSX Keychain"
git credential-osxkeychain erase https://github.com
Then try again: it will prompt for user GitHub username/password.
来源:https://stackoverflow.com/questions/58173646/git-error-permission-to-afriedman1991-ps-change-log-notifier-git-denied-to-scr