Git 推送命令报错

Git 推送命令报错

今天下午在敲代码的时候,非常自然的输入 git add .git commit -m"xxxgit push

结果直接报错

To https://gitee.com/where-know-return/freshman-semester.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/where-know-return/freshman-semester.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.

然后我就思考,我干了啥,为啥推送不了了(之前确实没有多人合作过)

然后我就去网上找教程,然后教程说,是gitee中的README.md文件不在本地代码目录中

我又检查了一下,发现,README文件在啊,但是我只好按照教程说的

执行了以下语句

git pull --rebase origin master

-----------------------------------------------------------------------------------------------------
git push

结果你猜怎么着,竟然push成功了!!!

这时我突然想起来了,下午的时候通过手机端给仓库传过代码,rebase 命令是为了更新我的本地仓库。

果然,分布式yyds!!!


感觉挺有意思的,所以记录下来!

posted @ 2022-04-19 17:01  codezzzsleep  阅读(115)  评论(0)    收藏  举报