无法在 git "failed to push some refs" 上推送工作



我一直试图在github上推动我的工作,但我得到了这个错误:

PS C:UsersxxxDesktopwikiwiki> git push origin --all
To https://github.com/me50/xxx.git
! [rejected]        web50/projects/2020/x/wiki -> web50/projects/2020/x/wiki (fetch first)
error: failed to push some refs to 'https://github.com/me50/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.

首先尝试git pull,然后尝试推送。

如果以上不起作用,那么试试这个,

git push --force-with-lease origin(这将覆盖您的本地分支机构的远程更改。(

由于您的原始分支位于本地分支之前而导致错误。

在将来自远程源的更改与本地更改合并之前,您应该执行git pull

尝试

$ git pull --rebase origin master
$ git push -u origin master

参考编号:https://www.programmersought.com/article/22301895864/

最新更新