GitHub 上创建了 readme.md 时提交到远程报错,附上解决方案
在github上新建仓库勾选了创建 README.md 时,如果根据教程中推送到远程会报错如下:
vagrant@homestead:~/Code/Laravel$ git push -u origin master
To git@github.com:xxx/hello_laravel.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xxx/hello_laravel.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.
因为github上的版本和本地版本会产生冲突,可以加上 -f
参数强制提交:
git push -u origin master -f
推荐文章: