Git之常见异常收集
来源:互联网 发布:linux安装libssl dev 编辑:程序博客网 时间:2024/06/04 09:41
1 Push to origin /master was rejected
参考:https://stackoverflow.com/questions/40142180/android-studio-git-push-rejected
2 failed to push some refs to
描述:
$ git push -u origin master
To git@github.com:******/Demo.git! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:******/Demo.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).使用强制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]
$ 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]
参考:《push本地代码到github出错》
3 fatal: refusing to merge unrelated histories
描述:这是从远程库pull项目,合并文件发生的异常
解决方案:在pull的时候添加 --allow-unrelated-histories。
$ git pull origin master ----allow-unrelated-histories
参考:《 git无法pull仓库refusing to merge unrelated histories》
4 error:src refspec master does not match any
描述:在push项目的时候,引发该异常。
原因分析:目录中没有文件,空目录是不能提交上去的,获取没有add、commit文件直接进行push了。
解决方案:
$touch README
$git add README
$git commit -m 'first commit'
$git push origin master
参考:《error: src refspec master does not match any解决办法》
《error: src refspec master does not match any》
5 fatal: Authentication failed for 'https://github.com/ ...
描述:使用的https提交,在用SourceTree提交代码时候发生错误,返回的错误提示说:
fatal: Authentication failed for 'https://github.com/ ...
解决方案:重新执行Git config命令配置用户名和邮箱即可:
$git config -–global user.name "xxx"
$git config –-global user.email "xxx@xxx.com"
$git config –-global user.email "xxx@xxx.com"
6 ! [rejected] master -> master (fetch first)
描述:To git@git.oschina.net:yangzhi/hello.git
! [rejected] master -> master (fetch first)error: failed to push some refs to 'git@git.oschina.net:yangzhi/hello.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinhint: to the same ref. You may want to first merge 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 -u origin master -f
阅读全文
1 0
- Git之常见异常收集
- JAVA常见异常收集
- Spring 常见异常收集
- java中碰到的常见异常收集
- okhttp+retrofit常见网络异常收集
- Git常见错误收集(随时更新.....)
- 异常收集 ----雨之殇
- Java笔记之常见异常
- java面试之常见异常
- SQL Server 2008 常见异常收集(持续更新)
- iOS开发之异常收集机制
- git命令之git 常用操作命令收集
- 异常收集
- 异常收集
- 异常收集
- 异常收集
- 初探RMI之几个常见异常排除
- Android开发 之 常见异常处理
- 机器学习故事汇-梯度下降
- 【网络基础 四】网络层
- 论文笔记:Deep Residual Learning for Image Recognition
- kerberos认证原理---讲的非常细致,易懂
- Python数据分析库Pandas教程——简介
- Git之常见异常收集
- autoit pro
- Eclipse-复制项目存在的问题及解决方案
- SVN 新文件 不能commit
- JAVA之BigInteger
- java 重写equals方法
- Putty工具连接用务器
- 【网络基础 五】运输层
- a标签onclick事件解析