刚创建的远程版本库,在push代码时出错
2017-01-10 09:07
225 查看
$ git push -u origin master
error:failed to push some refs to xxxx@xxx
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
网上搜索了一下,是因为远程repository 和我本地的repository冲突导致的,而我在创建版本库后在 push一次后修改本地的版本库内容,再次push的时候没有将远程仓库的内容pull到本地就产生了版本冲突的问题。
有如下几种解决方法
1.使用强制push的方法:$git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2.push 前先将远程repository 修改pull下来
$ git pull origin master
$ git push -u origin master
3.若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$git push -u origin [name]
error:failed to push some refs to xxxx@xxx
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
网上搜索了一下,是因为远程repository 和我本地的repository冲突导致的,而我在创建版本库后在 push一次后修改本地的版本库内容,再次push的时候没有将远程仓库的内容pull到本地就产生了版本冲突的问题。
有如下几种解决方法
1.使用强制push的方法:$git push -u origin master -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
2.push 前先将远程repository 修改pull下来
$ git pull origin master
$ git push -u origin master
3.若不想merge远程和本地修改,可以先创建新的分支:
$ git branch [name]
然后push
$git push -u origin [name]
相关文章推荐
- 使用命令创建github代码仓库,push本地仓库到github远程代码仓库
- git远程共享库push代码出错
- git在本地创建工作空间并从远程版本库获取代码
- Git的纯命令操作,Install,Clone , Commit,Push,Pull,版本回退,撤销更新,分支的创建/切换/更新/提交/合并,代码冲突
- Git的纯命令操作,Install,Clone , Commit,Push,Pull,版本回退,撤销更新,分支的创建/切换/更新/提交/合并,代码冲突
- Git的纯命令操作,Install,Clone , Commit,Push,Pull,版本回退,撤销更新,分支的创建/切换/更新/提交/合并,代码冲突
- push本地代码到github出错
- 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中
- 使用git创建local branch并push到远程
- 创建链接服务器远程登录映射报错:消息15466 解密过程中出错解决办法
- 解决Sqlserver 2008 R2在创建登录名出错"此版本的 Microsoft Windows 不支持 MUST_CHANGE 选项。 (Microsoft SQL Server,错误: 15195)"
- Flash Builder导出发行版本出错:创建AIR出错:error306,Descriptor must support one of the following
- 创建局域网内远程git仓库,并将本地仓库push推到远程仓库中
- [完整代码]创建不受数据库限制的报表 VB.Net 版本 -2
- Git从创建到推送到远程版本库
- “花生壳” + “VisualSVN” 巧妙实现远程代码版本控制
- iphone开发必知点之--push远程通知代码设置,获得DeviceToken
- git创建远程版本库
- [完整代码]创建不受数据库限制的报表 VB.Net 版本 -1
- GitHub上创建远程版本仓库