GitHub Enterprise 中有一个仓库,有 1611 个分支。我尝试通过 bear repo 和 push --mirror 创建备份(符合文档:https://docs.github.com/en/repositories/creating-and-managing-repositories/duplicating-a-repository) 。从字面上看是这样的:
git克隆--barehttps://github.myorg.com/EXAMPLE-USER/OLD-REPOSITORY.git
cd 旧存储库
git push --mirror https://github.myorg.com/EXAMPLE-USER/NEW-REPOSITORY.git
推送最终出现错误,但远程仓库完好无损:
Enumerating objects: 56995, done.
Counting objects: 100% (34840/34840), done.
Delta compression using up to 12 threads
Compressing objects: 100% (730/730), done.
Writing objects: 100% (56995/56995), 230.72 MiB | 3.56 MiB/s, done.
Total 56995 (delta 34303), reused 34110 (delta 34110), pack-reused 22155
remote: Resolving deltas: 100% (44324/44324), completed with 8890 local objects.
remote: fatal error in commit_refs
To https://github.myorg.com/EXAMPLE-USER/NEW-REPOSITORY.git
! [remote rejected] Release/9.10.4 -> Release/9.10.4 (failure)
! [remote rejected] TFS_C60113 -> TFS_C60113 (failure)
! [remote rejected] TFS_C81349 -> TFS_C81349 (failure)
! [remote rejected] release/9.10.4 -> release/9.10.4 (failure)
! [remote rejected] Created_9.8_On_TFS -> Created_9.8_On_TFS (failure)
! [remote rejected] TFS_C53824 -> TFS_C53824 (failure)
! [remote rejected] TFS_C53825 -> TFS_C53825 (failure)
! [remote rejected] TFS_C53826 -> TFS_C53826 (failure)
...
! [remote rejected] archive/2024/patch/adobe -> archive/2024/patch/adobe (failure)
! [remote rejected] archive/2022/DELETE_MASTER -> archive/2022/DELETE_MASTER (failure)
error: failed to push some refs to 'https://github.myorg.com/EXAMPLE-USER/NEW-REPOSITORY.git'
将分支或标签一一推送是没有问题的。 我想念什么?我可以调整一些东西来让它工作吗?有没有办法获得有关根本原因的更多详细信息?
未找到根本原因的描述。 可行的解决方法恰好是推送到捆绑包中的远程分支,然后是 git push --mirror:
git clone --mirror github.myorg.com/EXAMPLE-USER/REPOSITORY.git
git remote add ssh_mirror github.myorg.com/EXAMPLE-USER/NEW-REPOSITORY.git git push ssh_mirror refs/heads/archive/2024/A*
git push ssh_mirror refs/heads/archive/2024/B*
....
git push ssh_mirror refs/heads/archive/2024/z*
git push --mirror ssh_mirror