$ git push -u origin master
To https://gitee.com/****/spring-cloud-*****-study.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/****/spring-cloud-****-study.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推送本地代码去新创建的远程仓库失败。
原因
在创建仓库的时候勾选了“使用Reamdme文件初始化这个仓库”。它会帮我们做一次初始提交,然后仓库就生成了README.m和.gitignore文件。当我们把本地项目关联到这个仓库把项目推送到仓库时,两端都是有内容的,但是这两份内容并没有联系。所以当我们推送到远程或者从远程拉取内容时,都会提示是没有被跟踪的内容,git报的提示中会让你先拉取再推送,但是拉取总是失败。
解决方法
git fetch o