GitHub - error: failed to push some refs to 'git@github.com:myrepo.git'

前端 未结 10 2031
滥情空心
滥情空心 2020-12-23 14:21

I am getting the following error. How do I resolve?: git add . git commit -m \'t\' git push origin development

To git@github.com:myrepo.git
 ! [         


        
相关标签:
10条回答
  • 2020-12-23 14:38

    In my case git push was trying to push more that just the current branch, therefore, I got this error since the other branches were not in sync.

    To fix that you could use: git config --global push.default simple That will make git to only push the current branch.

    This will only work on more recent versions of git. i.e.: won't work on 1.7.9.5

    0 讨论(0)
  • 2020-12-23 14:40

    I used this command and it worked fine with me:

    >git push -f origin master
    

    But notice, that may delete some files you already have on the remote repo. That came in handy with me as the scenario was different; I was pushing my local project to the remote repo which was empty but the READ.ME

    0 讨论(0)
  • 2020-12-23 14:40

    In my case Github was down.

    Maybe also check https://www.githubstatus.com/

    You can subscribe to notifications per email and text to know when you can push your changes again.

    0 讨论(0)
  • 2020-12-23 14:42

    In my case. I had the error because I forgot to make a commit after create a repository on github into an existing project. So I solved:

    git add .
    git commit -m"commentary"
    

    Then I was able to type:

    git push -u origin master
    
    0 讨论(0)
  • 2020-12-23 14:43

    In windows, you need to use double quotes "". So the command would be

    git commit -m "t"

    0 讨论(0)
  • 2020-12-23 14:46

    Your origin repository is ahead of your local repository. You'll need to pull down changes from the origin repository as follows before you can push. This can be executed between your commit and push.

    git pull origin development
    

    development refers to the branch you want to pull from. If you want to pull from master branch then type this one.

    git pull origin master
    
    0 讨论(0)
提交回复
热议问题