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

后端 未结 30 1172
轻奢々
轻奢々 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:13

    Figured it out. I cloned over HTTPS. Setting up my public SSH keys, cloning over SSH, and pushing over SSH fixed it.

    0 讨论(0)
  • 2020-11-22 05:13

    I faced the same error and the cause was stupid - I did not have privileges to commit to selected repository. I did not know that I have to

    1. fork selected project first
    2. clone repository locally
    3. commit my changes locally
    4. push changes to my github clone
    5. request pull request to upstream

    as described in https://help.github.com/categories/63/articles

    0 讨论(0)
  • 2020-11-22 05:14

    what worked for me is changing from http to ssh:

    git remote rm origin
    git remote add origin git@github.com:username/repoName.git
    

    then check it with git remote -v

    0 讨论(0)
  • 2020-11-22 05:15

    If you are using windows, sometimes this may happen because Windows stores credentials for outer repo (in our case github) in its own storage. And credentials that saved there can be different from those you need right now.

    So to avoid this problem, just find github in this storage and delete saved credentials. After this, while pushing git will request your credentials and will allow you to push.

    0 讨论(0)
  • 2020-11-22 05:15

    For anyone curious, my mac machine vs lucid vm ran git 1.7.6 vs 1.7.0.4, and the exact same repo was pushable from my mac (newer git) but not the VM

    Same curl version. Perhaps some older git versions don't support https pushes?

    0 讨论(0)
  • 2020-11-22 05:17

    Add the user name as part of the URL and This error happens because the git command is hitting http instead of https. So set the url

    git remote set-url origin https://<username>@github.com/Path_to_repo.git
    

    After which you will be prompted for password:

    0 讨论(0)
提交回复
热议问题