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来完成,见下图所示:

勾选强制覆盖已有的分支(可能会丢失改动),再点击上传,上传成功。



本文转自xwdreamer博客园博客,原文链接:http://www.cnblogs.com/xwdreamer/archive/2012/05/29/2523958.html,如需转载请自行联系原作者

目录
相关文章
|
5G 网络安全 开发工具
【错误记录】GitHub 错误 ( Push failed Unable to access xx:OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 )
【错误记录】GitHub 错误 ( Push failed Unable to access xx:OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 )
581 0
【错误记录】GitHub 错误 ( Push failed Unable to access xx:OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 )
使用smartgit拉取github项目出现: Exhausted available authentication methods错误
使用smartgit拉取github项目出现: Exhausted available authentication methods错误
702 0
使用smartgit拉取github项目出现: Exhausted available authentication methods错误
|
安全 Linux 开发工具
Git 技术篇 - 同步代码到github失败,提示non-fast-forward、error: failed to push some refs to问题解决方法,git pull的用法
Git 技术篇 - 同步代码到github失败,提示non-fast-forward、error: failed to push some refs to问题解决方法,git pull的用法
910 0
Git 技术篇 - 同步代码到github失败,提示non-fast-forward、error: failed to push some refs to问题解决方法,git pull的用法
|
Python
GitHub编程语言显示识别错误
GitHub编程语言显示识别错误
183 0
|
Linux 开发工具 git
如何修改Github上提交的错误用户地址和姓名
如何修改Github上提交的错误用户地址和姓名
410 0
|
Python
GitHub编程语言显示识别错误
GitHub编程语言显示识别错误
340 0
|
开发工具 git
Github错误:fatal: Authentication failed for 'https://github.com/ ...
GitHub push代码发生错误:fatal: Authentication failed for 'https://github.
7466 0
|
网络安全 开发工具 git
|
开发工具 git
搭建 hexo,在执行 hexo deploy 后,出现 error deployer not found:github 的错误
hexo 更新到3.0之后,deploy的type 的github需要改成git 改了之后执行npm install hexo-deployer-git --save 然后再部署试试   官网说明: https://hexo.io/zh-cn/docs/deployment.html     部署Hexo 提供了快速方便的一键部署功能,让您只需一条命令就能将网站部署到服务器上。
2151 0