git提交远程库(push)报错
错误代码:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'codehub.devcloud.cn-north-4.huaweicloud.com:xgfz-jd-gh-zy17jjdsx-B600001/jQueryDemo.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.
错误原因:远程库中的README.md文件不在本地代码目录中
解决方法:
通过命令:git pull --rebase origin master
进行代码合并
执行命令之后,本地代码库会出现README.md文件和.gitignore文件
再次push推送远程库成功: