Git上传内容到仓库可能会出现的问题以及解决方法

今天我们组队创建了一个项目,我建立了几个文件,想上传到我们团队的GitHub仓库上面,但是一直不成功,显示以下错误:

 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'github.com:Oldwalnut/Animals.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命令就可以成功解决了。

posted @ 2022-03-20 19:21  信2005-2刘海涛  阅读(623)  评论(0)    收藏  举报