【问题标题】:Publishing branches with GitHub for Windows fails with no upstream branch使用 GitHub for Windows 发布分支失败,没有上游分支
【发布时间】:2015-01-25 09:56:56
【问题描述】:

当我尝试使用 Github for Windows 发布新的本地分支时,该过程失败且没有错误消息。打开shell并使用'git push'会报错:

fatal: The current branch local-branch-name has no upstream branch
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin local-branch-name

如果我剪切并粘贴此命令,推送会继续进行,我可以将 GUI 用于所有其他推送和拉取操作。我已经使用 GitHub for Windows 一年多了,而这才刚刚开始。我最近升级了,我正在运行版本 Great Dane 2.6.4.1。我不知道这是否有任何相关性。我没有看到很多报告,也没有看到任何关于此类问题的报告。

我是否在某处设置了导致此问题的标志? GitHub 默认更改了吗?什么可能导致这种行为? (我完全希望这是一个 PEBKAC 问题,我只是不知道我做了什么)。

【问题讨论】:

标签: git github git-push github-for-windows


【解决方案1】:

您需要调用特定上游或设置默认上游设置。

 $ git branch --set-upstream-to=origin/master
 $ git remote -v
       origin   https://github.com/mjbrender/simple-blog.git (fetch)
       origin   https://github.com/mjbrender/simple-blog.git (push)

如果你还没有一套:

$ git remote add upstream git@github.com/some-maintainer/some-project.git

您可以在项目克隆后避免再次这样做:

$ git config --global push.default simple

【讨论】:

  • 究竟使用什么?这有帮助吗?
  • 抱歉,这只是半条评论 - 不知道其余部分发生了什么 我使用 $ git config --global push.default simple 更新了我的配置,但没有任何效果。我仍然无法通过 Github for Windows GUI 发布新的本地分支。
  • 您无法通过 Github for Windows GUI 在运行git config --global push.default simple 命令之前克隆的项目上发布新的本地分支?运行该命令、分支然后发布后尝试重新克隆。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-12-29
  • 1970-01-01
  • 2013-04-05
  • 2011-05-23
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多