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

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

    Github has page dedicated to troubleshooting this error:

    https://help.github.com/articles/https-cloning-errors

    In my case it turned out that using a new version of git (1.8.5.2) solved this problem.

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

    None of the above answers worked for my enterprise GitHub account. Follow these steps for pushing via ssh key generation way.

    Create a repo by visiting your git account.

    Generate ssh key:

    ssh-keygen -t rsa -C "your_email@example.com"
    

    Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings. Test SSH key:

    ssh -T git@github.com
    clone the repo:
    git clone git://github.com/username/your-repository
    

    Now cd to your git clone folder and do:

    git remote set-url origin git@github.com:username/your-repository.git
    

    Now try editing a file (try the README) and then do:

    git add -A
    git commit -am "my update msg"
    git push -u origin master
    

    Update: new git version seems to recommend not to have any file while new repo is created. Hence make aa blank repo.

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

    I actually had a very simple fix to this. All i did was edit the git config file differently after cloning the repository. The remote origin url is what you need to edit in your default config file. It should look like seen below

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://*username*@github.com/*username*/*repository*.git
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    
    0 讨论(0)
  • 2020-11-22 05:21

    I just got the same problem and just figured out what's cause.

    Github seems only supports ssh way to read&write the repo, although https way also displayed 'Read&Write'.

    So you need to change your repo config on your PC to ssh way:

    1. edit .git/config file under your repo directory
    2. find url=entry under section [remote "origin"]
    3. change it from url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to url=git@github.com/derekerdmann/lunch_call.git. that is, change all the texts before @ symbol to ssh://git
    4. Save config file and quit. now you could use git push origin master to sync your repo on GitHub
    0 讨论(0)
  • 2020-11-22 05:21

    Do this for a temporary fix

    git push -u https://username:password@github.com/username/repo_name.git master

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

    This happened to me because my coworker accidentially disabled the repository that this repository was forked from. Just might check to ensure that the original git(hub) repo actually still exists.

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