带有分离头的 git 存储库镜像导致错误:GH002

问题描述

以下代码在 Azure Pipeline 中运行以将源镜像到另一个 git 存储库。

git remote add --mirror=fetch mirror MIRROR_REPO

git push mirror --progress --prune +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*

当代理运行时,它会检查特定提交处的代码,这会导致分离的头部具有提交 SHA 的名称。这是代理生成的日志:

 * [new ref]           6ADFB183A4A2C94A2F92DAB5ADE762A47889A5A1 -> origin/6ADFB183A4A2C94A2F92DAB5ADE762A47889A5A1
git checkout --progress --force 6ADFB183A4A2C94A2F92DAB5ADE762A47889A5A1
Note: switching to '6ADFB183A4A2C94A2F92DAB5ADE762A47889A5A1'

我猜这就是 git push mirror 命令失败并出现以下错误的原因:

remote: error: GH002: Sorry,branch or tag names consisting of 40 hex characters are not allowed.        
remote: error: Invalid branch or tag name "6ADFB183A4A2C94A2F92DAB5ADE762A47889A5A1"   

我正在寻找一种方法,每次管道运行时将所有分支和标签从我的源存储库推送到我的镜像存储库。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)