解决办法:error: failed to push some refs to ‘https://github.com/xxxx.git‘

当我在本地仓库用push到远程仓库是发生一下的错误:

fengxun@DESKTOP-GL9HQRU MINGW64 /d/GitWorkSpace (master)
$ git push origin master
To https://gitee.com/woshifanlan/git_study.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/woshifanlan/git_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.

原因:出现错误的主要原因是gitee中的README.md文件不在本地代码目录中
可以通过如下命令进行代码合并

git pull --rebase origin master

然后在输入

git push origin master   #即可完成代码上传到gitee

你可能感兴趣的:(Git)