我正在将一个git repo迁移到另一个.要做到这一点,我正在使用--mirror
标志clone
和push
操作.
这有效,除了最后的失败,导致我的bash脚本失败,这看起来是孤立的拉取请求:
! [remote rejected] refs/pull/1/head -> refs/pull/1/head (The current action can only be performed by the system.)
! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (The current action can only be performed by the system.)
! [remote rejected] refs/pull/2/head -> refs/pull/2/head (The current action can only be performed by the system.)
! [remote rejected] refs/pull/3/head -> refs/pull/3/head (The current action can only be performed by the system.)
是否有必要迁移拉取请求?
我什么时候可以省略拉取请求git push --mirror
?
我已经看到了修改配置文件的参考,但我更愿意在CLI处理它,如果可能的话.
为了避免推送请求,您可以(通过命名)推送所需的引用,而不是--mirror
全部查找。此文章提供了一个选项(一旦您安排了本地克隆):
$ git push --prune git@example.com:/new-location.git +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
Run Code Online (Sandbox Code Playgroud)
您可能希望通过列出.git/refs
(省略.git/refs/pull
)在脚本中以编程方式生成该参考列表,以确保您选择了其中可能存在的其他参考,例如替换参考或其他自定义参考。
是否有必要迁移拉取请求?
我认为您将无法做到。如果您要从一个GitHub存储库迁移到另一个GitHub存储库,则您期望的行为是预期的:
远程refs / pull /名称空间是只读的。
该refs/pull/
命名空间是特定于GitHub上,所以如果你从或迁移PR将要求其终端支持的一些其他服务(如到位桶)迁移。Bitbucket不支持这种东西,其他人可能会以不同的方式实现它。
使用--mirror
指示Git复制所有引用,就像refspec一样+refs/*:refs/*
.(用git clone
它设置一个提取镜像:一个裸克隆,其默认refspec是相同的+refs/*:refs/*
,默认情况下启用剪枝.)
正如您所看到的,一些Git服务器甚至拒绝对某些引用进行强制更新.特别是,GitHub refs/pull/
为自己的目的保留命名空间.
是否有必要迁移拉取请求?
据我所知,甚至不可能在GitHub上做到这一点(当然GitHub人员可能会从他们的最终做到这一点).
我什么时候可以省略拉取请求
git push --mirror
?
我认为最简单的方法是在git clone --mirror
步骤后删除它们:
git for-each-ref --format 'delete %(refname)' refs/pull | git update-ref --stdin
Run Code Online (Sandbox Code Playgroud)
但你也可以明确地推送你关心的引用,这些引用可能只是那些refs/heads/
和refs/tags/
,也许refs/replace/
和/或refs/notes/
.
归档时间: |
|
查看次数: |
648 次 |
最近记录: |