无法跟踪远程分支 - 无法识别origin/develop

Sha*_*.io 15 git

我有git 1.8.3和一个带有'master'和'develop'分支的repo.

从我当地的"开发"分支,我正在尝试执行以下命令 -

git branch -u origin/develop

我得到一个错误

error: the requested upstream branch 'origin/develop' does not exist

当我检查时,git branch -r我只看到了origin/master

我正试图找到一种方法让我的系统认识到还有一个origin/develop并且找不到任何有效的解决方案.

Jan*_*ger 25

  • 如果分支develop已存在于远程存储库中,请使用git fetch更新"远程跟踪分支"(本地镜像).
    • 这要求正确设置fetch refspec(在.git/config远程部分中); 默认是fetch = +refs/heads/*:refs/remotes/<name of remote>/*.在某些情况下,可以将配置设置为仅提取一个分支(使用特定分支名称而不是通配符).更改配置应该是安全的; 这将允许获取所有分支.
  • 如果远程存储库中的分支尚不存在,您可以在第一次推送时设置关联:( git push -u origin develop它会在您推送命令的同时处理您尝试对命令执行的操作.科)

  • 也许你的refspecs很奇怪......看看.git/config中的``remote"origin"]部分.它应该有这一行:`fetch = + refs/heads/*:refs/remotes/origin/*` - 如果`fetch`行不同(甚至丢失),fetch可能无法正确更新`origin中的所有内容/`命名空间. (5认同)
  • 我在这里发现了这个`git branch --unset-upstream`(http://www.lornajane.net/posts/2014/understanding-tracking-branches-in-git)让我远程上游,让我推到新遥控器. (2认同)