[git 報(bào)錯(cuò):error: failed to push some refs to 'https://gitee.com/xxx/******.git'(已解決)]
提交push 報(bào)錯(cuò):
$ git push origin master
To https://gitee.com/xxx/******.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/xxx/******.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.
這是因?yàn)檫h(yuǎn)程庫(kù)里面有個(gè)文件扶檐,但是本地沒(méi)有這個(gè)文件,完全提交上去會(huì)覆蓋之前的文件(通常是因?yàn)檫h(yuǎn)程庫(kù)自動(dòng)生成了一個(gè)REMAND.MD的文件原因哺窄,但是本地沒(méi)有add到這個(gè)文件)
我們直接強(qiáng)制push 下就可以了:
$ git push -u origin master -f