首页 > 解决方案 > 从特定分支执行 git pull 后无法推送

问题描述

我之前没有与其他使用 github 的人合作过,所以有点混乱,他们给了我一个分支来推送。这是我推送代码的方法,

git add .
git commit -m "Update layout, add chat app"
  69 files changed, 6657 insertions(+), 228 deletions(-)
git remote add origin https://github.com
git push -u origin myBranch

然后它说

error: src refspec myBranch does not match any
error: failed to push some refs to 'https://github.com/boryio/everytalk-app.git'

所以我尝试了stackoverflow的几种解决方案,我找到了这个解决方案。

git push -f origin myBranch

 * branch            myBranch     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Update layout, add chat app

然后我尝试了这个

git pull --rebase origin myBranch

 * branch            myBranch     -> FETCH_HEAD
Created autostash: 1eb65d7
Current branch kepha is up to date.
Applied autostash.

但是我在github上的代码没有改变,知道如何解决这个问题吗?

编辑

在此处输入图像描述

我不知道这是不是一个错误

git push -f origin myBranch
 * branch            myBranch     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Update layout, add chat app

就像你们说的那样

git pull origin myBranch
 * branch            myBranch     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Update layout, add chat app

在这种状态下我该怎么办?

标签: git

解决方案


不可能是您运行并得到的:

git push -f origin myBranch

 * branch            myBranch     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Update layout, add chat app

因为您显示的输出是您从中获得的git pull,而不是从git push.

git push -u origin myBranch
error: src refspec naonvl does not match any
error: failed to push some refs to 'https://github.com/boryio/everytalk-app.git'

这也不符合。第一error行表示您没有名为 的分支naonvl。您的git push命令指定了一个名为myBranch.

这似乎naonvl是一个错字:例如,您将其命名为 branch naoval。解决方法是纠正您的错字。

(重要的是,在发布问题时,要非常小心,不要让其他人无法帮助您。请参阅我如何提出一个好的问题?


推荐阅读