You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git fetch未拉取上游stable分支,创建本地分支报错求助

解决无法检出上游stable分支的问题

问题原因

你的本地Git仅拉取到了upstream仓库的master分支,说明upstream远程的fetch配置被限制为只跟踪master分支,导致stable分支未被同步到本地。

解决步骤

  1. 检查当前upstream的fetch规则:
git config --get-regexp remote.upstream.fetch

若输出为remote.upstream.fetch +refs/heads/master:refs/remotes/upstream/master,则确认是fetch规则限制了分支拉取。

  1. 修改upstream的fetch配置,使其拉取所有分支:
git config remote.upstream.fetch "+refs/heads/*:refs/remotes/upstream/*"
  1. 重新拉取upstream仓库的所有分支:
git fetch upstream
  1. 再次查看远程分支,此时应该能看到upstream/stable,执行检出命令:
git switch -c stable upstream/stable

内容的提问来源于stack exchange,提问作者Felipe Plets

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 06:15:01