Git 复制后远程分支丢失

Git 复制后远程分支丢失,git,Git,我在复制GIT存储库时遇到问题, 遵循所描述的步骤 内部/c/dev/temp repo:git clone——裸https://github.com/exampleuser/old-repository.git 在/c/dev/temp repo/old-repository.git内部:git推送--镜像https://github.com/exampleuser/new-repository.git 在第1步之后,通过在/c/dev/temp repo/old-repository.git

我在复制GIT存储库时遇到问题, 遵循所描述的步骤

  • 内部/c/dev/temp repo:
    git clone——裸https://github.com/exampleuser/old-repository.git
  • 在/c/dev/temp repo/old-repository.git内部:
    git推送--镜像https://github.com/exampleuser/new-repository.git
  • 在第1步之后,通过在/c/dev/temp repo/old-repository.git中键入
    git branch-a
    ,我可以看到缺少一些远程分支。 因此,在第2步之后,新回购协议也缺少这些分支。 Git版本2.7.0.windows.1


    如何复制所有远程分支?谢谢你,莎伦。

    那些GitHub的说明似乎是错误的。如果您希望新的GitHub克隆与原始GitHub存储库相同,并且由于某种原因分叉不好,1您需要在这两个步骤上都使用
    --mirror
    选项。(注意,
    git clone--mirror
    意味着
    --bare
    ,因此可以省略
    --bare
    部分。)



    1通常情况下,执行GitHub fork操作会做正确的事情(我认为——我实际上不太使用GitHub).

    使用
    git clone--mirror
    获得相同的结果。没有提到我没有使用GitHub,所以分叉不是一个选项。由于
    git clone--mirror
    设置了一个裸存储库,将
    refs/*
    从源复制到克隆,它应该有每个(公共)引用,包括所有注释,远程跟踪分支等。原始版本有哪些克隆版本所缺少的?使用引用隐藏功能的不是GitHub上的原始版本吗?
    git clone--mirror
    正确克隆了所有分支。我将镜像与我的工作副本进行比较,后者缓存了未签出的远程删除分支。我不知道删除的远程分支不会从本地工作副本中删除,只有当我访问服务器并看到它们消失时,我才意识到这一点。