Git的理念和使用都需要长期的经验和无尽的坑来填,否则你无法体会到它的强大!最近远程创建了含有Readme的仓库(以后在github上创建仓库时候我再也不添加README了), 本地初始化并添加了远程仓库后, push却失败了, 出现提示:
$ git push origin dev123456789101112131415To 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 dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
- 问题(Non-fast-forward)出现的原因是: git仓库中已有一部分代码, 它不允许你直接把你的代码覆盖上去。于是你有2个选择方式:
|
|
- 可是, 有时候还会出现问题:
|
|
- 这等于在告诉git2件事:
|
|
- 如果不想或者不会编辑config文件的话,可以在bush上输入如下命令行:
|
|
- 之后再重新git pull下。最后git push你的代码吧。
```