gpt4 book ai didi

linux - 将 --mirror push Git 存储库时出现重复文件错误

转载 作者:太空宇宙 更新时间:2023-11-04 10:47:18 25 4
gpt4 key购买 nike

我需要将我现有的存储库推送到 Git 中的另一个空存储库。我收到以下错误:

remote: unpack error Invalid tree 300894f515: duplicate entry names
error: unpack failed: error Invalid tree 300894f515: duplicate entry names

在尝试了几个选项后,我终于重写了历史并推送了 master 分支。但是当我再次尝试推送 --mirror 时,它显示了同样的错误。我在这里附上日志。

  1. git clone URL
  2. git branch -a

    * master
    remotes/origin/HEAD -> origin/master
    remotes/origin/MyTestBranch
    remotes/origin/ABC
    remotes/origin/XYZ
    remotes/origin/TEST
  3. git remote add test REMOTE URL

  4. git remote -v

    origin  git@github.................. (fetch)
    origin git@github................... (push)
    test https://abc........................................... (fetch)
    test https://abc........................................... (push)
  5. git fsck --full

    error in tree 300894f515b714a42efd603f4196d45c8c1f3c09: contains duplicate file entries
    error in tree a84c6e1cc242cdc4c7d7ce5246be02672d1eaf3a: contains duplicate file entries
  6. git filter-branch --index-filter 'mv "$GIT_INDEX_FILE""$GIT_INDEX_FILE.tmp"&& GIT_INDEX_FILE=$GIT_INDEX_FILE.tmp git ls-files -s | git update-index --index-info'

  7. git push测试大师

    Counting objects: 33396, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (10456/10456), done.
    Writing objects: 100% (33396/33396), 86.61 MiB | 16.05 MiB/s, done.
    Total 33396 (delta 17522), reused 31573 (delta 17001)
    remote: Resolving deltas: 100% (17522/17522)
    remote: Counting objects: 33396, done
    remote: Updating references: 100% (1/1)
    To https://abc.................................................................git
    * [new branch] master -> master
  8. git push --mirror test

    Counting objects: 35959, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (11059/11059), done.
    Writing objects: 100% (35631/35631), 86.91 MiB | 16.52 MiB/s, done.
    Total 35631 (delta 19237), reused 35489 (delta 19127)
    remote: unpack error Invalid tree 300894f515: duplicate entry names
    error: unpack failed: error Invalid tree 300894f515: duplicate entry names

如何解决这个问题?

最佳答案

您重写的历史位于 refs/heads/master(即 master 分支)。但是 filter-branch 将在 refs/original/refs/heads/master 中创建损坏历史的备份。您的 --mirror 推送将发送它,导致另一方提示。

你可能想要git update-ref -d refs/original/refs/heads/master

关于linux - 将 --mirror push Git 存储库时出现重复文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32577974/

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