酷卡特 發表於 2021-12-28 17:27:00

gitee推送报错error: failed to push some refs to

<p>今天在gitee创建了一个项目,打算把本地代码推送上去,发现报错了,报错如下:</p>
<div class="cnblogs_Highlighter">
<pre class="brush:csharp;gutter:true;">error: failed to push some refs to 'https://gitee.com/xxxx'
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.
</pre>
</div>
<p>分析原因:</p>
<p>是因为README.md文件不在本地代码目录中</p>
<p>解决方法:</p>
<p>执行以下命令,把README.md拉到本地</p>
<div class="cnblogs_Highlighter">
<pre class="brush:csharp;gutter:true;">git pull --rebase origin master
</pre>
</div>
<p>然后执行以下命令,推送文件</p>
<div class="cnblogs_Highlighter">
<pre class="brush:csharp;gutter:true;">git push origin master</pre>
</div><br><br>
来源:https://www.cnblogs.com/lucktomato/p/15741512.html
頁: [1]
查看完整版本: gitee推送报错error: failed to push some refs to