updates were rejected because th

2023-03-27  本文已影响0人  dming1024

在使用git pushGitHub提交代码时,遇到了这样的报错

git push -u origin main
To https://github.com/dming1024/MSIcal.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/dming1024/MSIcal.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.

解决方案

参考:stackoverflow

git pull origin main

 git push origin main
#或强制push
git push -f origin main

出现二次报错

 git push -f origin main
fatal: unable to access 'https://github.com/dming1024/MSIcal.git/': Failed to connect to github.com port 443: Timed out
(base)

需要设置代理,参考文章:Github 代理

git config --global --unset http.proxy
git config --global --unset https.proxy

再进行push即可

git push -f origin main
上一篇 下一篇

猜你喜欢

热点阅读