github中non-fast-forward错误的解决

参考文献

1.http://www.linuxidc.com/Linux/2012-04/58985.htm

2.http://ihower.tw/blog/archives/2620

3.http://hi.baidu.com/lettoo/blog/item/e2e7f30fec72bdf6ab645789.html

正文

学习使用git,可以参考文献3,但是在操作的最后一步,也就是想将代码上传到git中去的时候,出现如下错误:

复制代码
Pushing to git@github.com:xwdreamer/FirstRepo_xuwei.git
To git@github.com:xwdreamer/FirstRepo_xuwei.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xwdreamer/FirstRepo_xuwei.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
复制代码

在网上查了也一些资料,见参考1中的内容,知道是因为git中的内容与本地中的内容部一直,需要先fetch,然后再merge,最后上传push。但是不会操作,后面又说可以通过强制push来完成,

posted @ 2016-04-30 15:32  风与叶子  阅读(354)  评论(0编辑  收藏  举报