Pushing to Git returning Error Code 403 fatal: HTTP request failed

后端 未结 30 1191
轻奢々
轻奢々 2020-11-22 04:52

I was able to clone a copy of this repo over HTTPS authenticated. I\'ve made some commits and want to push back out to the GitHub server. Using Cygwin on Windows 7 x64.

30条回答
  •  情深已故
    2020-11-22 05:04

    Same error and resolution on Mac OS X.

    Everything was working fine till I created a new account on GitHub and tried to push

    $ git push -u origin master
    

    And got the error:

    remote: Permission to NEWUSER/NEWREPO.git denied to OLDUSER. fatal: unable to access ‘https://github.com/NEWUSER/NEWREPO.git/': The requested URL returned error: 403

    It should have fixed by setting the user.name either for global or current repo

    $ git config –-global user.name NEWUSER
    $ git config user.name NEWUSER
    

    But it didn’t.

    I got it fixed by deleting the OLDUSER associated with GitHub from Keychain Access app under Passwords section. Then the push command went successful.

    $ git push -u origin master
    

    reference

提交回复
热议问题