第一次使用git上传代码时的一些问题
2016-11-02 16:19
399 查看
第一次上传代码时出现以下错误:
原因:远程代码库有某些文件本地代码库中不存在,会有冲突的隐患。
解决方法:需要先执行git pull的操作,把远程代码先拿下来,如下:
这时还是有错误,这是因为git拒绝合并无关的历史纪录,解决方法是在git pull时加上–allow-unrelated-histories,如下:
最后在push即可
D:\java_projects\test>git push origin master To https://git.oschina.net/qingke3/tom.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://git.oschina.net/qingke3/tom.git' hint: Updates were rejected because the tip of your current branch is behind 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 pull的操作,把远程代码先拿下来,如下:
D:\java_projects\test>git pull origin master From https://git.oschina.net/qingke3/tom * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories
这时还是有错误,这是因为git拒绝合并无关的历史纪录,解决方法是在git pull时加上–allow-unrelated-histories,如下:
git pull origin master --allow-unrelated-histories
最后在push即可
相关文章推荐
- 第一次上传代码到码云及遇到的一些问题和解决方式
- 最简洁高效的Git 命令上传代码【以及Git的一些经常使用的小命令】
- android studio使用git第一次配置并上传代码到码云
- BAE添加部署后使用git上传代码遇到的问题
- 新手(自己)使用Xcode上传到git@osc遇到的一些问题
- 关于使用git上传代码到github,码云的问题
- Github:在eclipse中使用git clone 别人共享在Github的代码和上传到自己的仓库!
- 【eclipse下使用git上传(下载)代码至(从)github】
- Git使用、Git配置、Git提交代码、Git上传
- 使用Git上传项目代码到github
- 【FIRST USE】第一次用git把代码上传到github
- 在Windows系统下Git使用过程中配到的一些问题汇总(持续更新)
- Eclipse上安装GIT插件,使用EGit上传代码到代码库
- Windows下Git服务器搭建及使用过程中的一些问题
- git使用之如何将github库下载到本地与如何将代码上传github
- Eclipse之使用git上传代码
- 如何使用Git上传项目代码到代码服务器
- git使用之如何将github库下载到本地与如何将代码上传github
- 如何使用Git上传项目代码到github
- 使用Git将本地代码上传到GitHub