【问题标题】:git pushing to remote branch is throwing errorgit推送到远程分支抛出错误
【发布时间】:2017-07-22 00:18:13
【问题描述】:

我从远程存储库创建了一个分支并更改了本地存储库名称。后来我通过运行git branch --unset-upstream 命令删除了跟踪。 现在,当我尝试将本地更改推送到远程分支时,出现以下错误

git push --set-upstream origin feature/my_remote_branch

error: src refspec feature/my_remote_branch does not match any.
error: failed to push some refs to 'https://pradeep@bitbucket.comp.com/scm/app/app.git'

我哪里出错了?

【问题讨论】:

  • 当然,如果您使用 --unset-upstream,您会收到此错误。仔细阅读文档。
  • 我在我的问题中更新了 git push 命令。仍然遇到同样的错误
  • 本地分支叫什么,远程分支叫什么?
  • 错误消息error: src refspec feature/my_remote_branch does not match any 表示Git 不相信 有一个名为feature/my_remote_branch 的分支。它甚至还没有调用另一个 Git,它说“我不知道任何具有这个名称的分支。”
  • 本地分支名称为feature-one-branch,远程分支名称为refs/heads/feature/my_remote_branch

标签: git git-merge git-commit git-push


【解决方案1】:

试试这个:git push -u <remote> <local-branch>:<remote-branch>

$ git push -u origin feature-one-branch:my_remote_branch


Or, (if not works)
$ git push -u feature my_remote_branch

【讨论】:

    【解决方案2】:

    由于您的本地分支和远程分支具有不同的名称,因此只要您没有相应地设置跟踪,就需要在推送命令中同时指定两者。

    git push --set-upstream origin feature/my_remote_branch 尝试将本地分支 feature/my_remote_branch 推送到您本地没有的远程。

    你应该打电话给

    git push --set-upstream origin feature-one-branch:feature/my_remote_branch
    

    【讨论】:

      【解决方案3】:

      如果您是第一次尝试尝试

      git push  origin -u feature/my_remote_branch
      

      【讨论】:

        猜你喜欢
        • 2012-08-09
        • 2011-09-10
        • 2016-07-08
        • 2012-07-25
        • 2018-12-22
        • 1970-01-01
        • 2015-08-14
        • 2014-02-04
        • 2016-10-25
        相关资源
        最近更新 更多