[转载]如何解决failed to push some refs to git

[email protected] /K/cocos2d/yc (master)

$ git push -u origin master

To [email protected]:yangchao0718/cocos2d.git

! [rejected]        master -> master (non-fast-forward)

error: failed to push some refs to ‘[email protected]:yangchao0718/cocos2d.git

hint: Updates were rejected because the tip of your current branch is behin

hint: its remote counterpart. Integrate the remote changes (e.g.

hint: ‘git pull ...‘) before pushing again.

hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details.

在使用git 对源代码进行push到gitHub时可能会出错,信息如下

  1. 此时很多人会尝试下面的命令把当前分支代码上传到master分支上。

    $ git push -u origin master

    但依然没能解决问题

  2. 出现错误的主要原因是github中的README.md文件不在本地代码目录中

  3. 可以通过如下命令进行代码合并【注:pull=fetch+merge]

    git pull --rebase origin master

  4. 执行上面代码后可以看到本地代码库中多了README.md文件

  5. 此时再执行语句 git push -u origin master即可完成代码上传到github

时间: 2024-08-02 17:16:13

[转载]如何解决failed to push some refs to git的相关文章

如何解决failed to push some refs to git

[email protected] /K/cocos2d/yc (master) $ git push -u origin master To [email protected]:yangchao0718/cocos2d.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:yangchao0718/cocos2d.git hint: U

解决failed to push some refs to git

[email protected] /K/cocos2d/yc (master) $ git push -u origin master To [email protected]:yangchao0718/cocos2d.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:yangchao0718/cocos2d.git hint: U

解决 failed to push some refs to '[email protected]:zle1992/head-first-java' hint: Updates were rejected because the tip of your curr

问题描述: 寒假之前用实验室电脑push到github 上head first java 的程序,寒假回家后,想用自己的笔记本继续编,继续push . 我先从github下载zip到本地,然后 解压后,继续编程,但是用git push origin master 出现问题如下: 试了很多方法,最终解决方案如下: 思路: 新建一个文件夹,用pull 命令把文件从github下载下来,编写好新的程序,git add  git commit  git push 参考: http://www.tuico

error: failed to push some refs to ‘git@xxx.git‘

[问题描述]:通过 git push -u origin master 提交代码时出现如下报错: ##git push -u origin master Enumerating objects: 96, done. Counting objects: 100% (96/96), done. Delta compression using up to 4 threads Compressing objects: 100% (74/74), done. Writing objects: 100% (

GIT用git push出现failed to push some refs to git...的解决方法

错误提示: [email protected] /K/cocos2d/yc (master) $ git push -u origin master To [email protected]:yangchao0718/cocos2d.git ! [rejected]        master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:yangchao0718/cocos2

解决failed to push some refs to

由于github我使用了dev和feature分支,团队合作合并到dev,个人开发都是feature....今天在本地feature中git pull origin dev 出现 在使用git 对源代码进行push到gitHub时可能会出错, 出现错误的主要原因是github中的README.md文件不在本地代码目录中 可以通过如下命令进行代码合并[注:pull=fetch+merge] git pull --rebase origin dev 执行上面代码后可以看到本地代码库中多了README

解决error: failed to push some refs to 'xxxx'

copy from :https://blog.csdn.net/k_young1997/article/details/90489734 今天将项目修改了一部分,然后用 git push origin master 向远程仓库推送的时候报如下错误: error: failed to push some refs to 'https://github.com/ZJyoung1997/JZShop.git'hint: Updates were rejected because the remote

Git error (failed to push some refs)解决

当修改了本地仓库后 提交代码时, 用 git push 提示以下错误 error:failed to push some refs to ... Dealing with "non-fast-forward" errors From time to time you may encounter this error while pushing: $ git push origin master To ../remote/ ! [rejected] master -> master

github 如何解决error: failed to push some refs

错误 error: failed to push some refs to 'https://github.com/whitclass/scrapy-spider.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the