我正在使用该命令来克隆存储库的分支,但我不知道为什么它会抛出该错误
git clone -b redux-basics https://github.com/mschwarzmueller/reactjs-redux-basics.git
为什么该命令返回给我
fatal: Remote branch redux-basics not found in upstream origin
请告诉我接下来我应该做什么
如果您只是浏览到您自己提供的 URL 并使用 GitHub 的 Web 界面查找分支名称,您将看到该存储库没有有名为
redux-basics
的分支。
它确实有一个名为
01-redux-basics
的分支(列在“过时”部分,最后更新于5年前)。
您可以使用
找到可用分支的列表git ls-remote --heads https://git.LINK_TO_REPO.git
返回类似的内容
46d0adaf08ef87d0aa840f9a4338d172bf931752 refs/heads/pilot/buildsplit
349502cbb72664c376b2392bdbe8179725a52012 refs/heads/testing/time
32670bd5f6014542d8f9f3854e5aebff5eb8dddf refs/heads/testing/health
如果我想克隆,例如分支
time
,不要忘记丢弃refs/heads/
部分并使用
git clone --single-branch -b testing/time https://git.LINK_TO_REPO.git
请注意,仅使用提交哈希而不是名称是行不通的。