gpt4 book ai didi

Github 克隆 repo 错误 : warning: remote HEAD refers to nonexistent ref, 无法 checkout

转载 作者:太空狗 更新时间:2023-10-29 14:43:45 27 4
gpt4 key购买 nike

我试图将 foo 存储库复制到新的 fooBar 存储库中。我遇到了一个错误,这是我所做的:

  1. 在 github 上创建了一个名为 fooBar 的新空白存储库
  2. 在与本地 foo 相同的目录中手动创建了 foo 文件夹(我想复制的存储库)的副本。
  3. 在本地将复制的foo(Copy) 重命名为fooBar
  4. cd fooBar 并根据 How to remove origin from git repository 运行 git remote rm origin (这可能是一个错误,因为我只是使用 github,而不是 git-svn)
  5. 将我的分支推送到我的新远程 fooBar 仓库,如下所示:git remote add origin https://github.com/myteam/fooRepo.gitgit push -u origin development(请注意,我使用了 development 而不是 master - 我认为 master 没有有任何意义,只是一个约定)
  6. 最后,当我看到它已成功推送到 github 时,我删除了我的 fooBar 文件夹。然后我试着 pull 它git clone https://github.com/myAccount/fooBar.git

然后我得到以下信息:

Cloning into 'fooBar'...
remote: Counting objects: 9297, done.
remote: Compressing objects: 100% (1727/1727), done.
remote: Total 9297 (delta 7542), reused 9297 (delta 7542), pack-reu
Receiving objects: 100% (9297/9297), 1.58 MiB | 253.00 KiB/s, done.
Resolving deltas: 100% (7542/7542), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

我找不到克隆时突出显示的错误的答案 - 每个人在删除远程分支并尝试 pull 它时似乎都遇到了问题。

warning: remote HEAD refers to nonexistent ref, unable to checkout.

请注意,在我的新 fooBar 存储库中,development 是唯一的分支并且它设置为 Default

最佳答案

克隆一个 repo 默认分支是 master。但是你的 masterbare (没有您的源文件的工作或 check out 副本)。所有代码都在 development 分支中。

因此,您需要在克隆时提及development 分支。或者,您需要推送一个 master 分支。

试试这个:

$ git clone https://github.com/myAccount/fooBar.git --branch development

或者,

 $ git clone https://github.com/myAccount/fooBar.git --branch development -b development --single-branch

关于Github 克隆 repo 错误 : warning: remote HEAD refers to nonexistent ref, 无法 checkout ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41269587/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com