一个关于git push失败的解决方案
问题背景:在GitHub上创建了一个repositorie, 本地初始化并添加了远程仓库后,在GitHub上创建了一个README.md文件(注意不是从本地git push上去的),随后本地修改工程源码再次git push时,报错。。。。
To https://git.oschina.net/erchoc/laradock.git ! [rejected] dev -> dev (fetch first) error: failed to push some refs to 'https://git.oschina.net/erchoc/laradock.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方案:
# 先输入git pull $ git pull # 再git push $ git push origin master
参考链接: http://www.jianshu.com/p/ea6ec80ad5f2
注:报错信息copy参考链接里的代码。