最近项目开发用到git,导师使用的是码云。
在Windows环境中使用Git连接码云,尝试push文件时报错:
*! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:huankai7/practice.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.
如图:
找了很多方法都是针对github的,最后找到一句命令行
$ git pull gitee master --allow-unrelated-histories
执行后成功上传。