使用 GitHub for Windows 发布分支失败,没有上游分支



当我尝试使用适用于Windows的Github发布新的本地分支时,该过程失败而没有错误消息。打开外壳并使用'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一年多了,这才刚刚开始。我最近升级了,我正在运行大丹犬 2.6.4.1 版本。我不知道这是否有任何相关性。我没有看到很多关于此类问题的报告或任何报告。

我是否在某处设置了导致此问题的标志?GitHub 默认值是否发生了变化?是什么原因导致这种行为?(我完全希望这是一个PEBKAC问题,我只是不知道我做了什么)。

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

 $ 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

最新更新