将--mirror推入Git存储库时出现重复文件错误 [英] duplicate file error while pushing --mirror into Git repository

查看:134
本文介绍了将--mirror推入Git存储库时出现重复文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  remote:解压缩错误无效树300894f515:重复的项名称
错误:解压缩失败:错误无效的树300894f515:重复的项目名称

在尝试了几个选项后,我能够重写历史和最后推动主分支。但是当我试图再次推送 - mirror 时,它显示了同样的错误。


  1. git clone URL


  2. $ b $ p $ g $ c $ g code code code code code code code code code code $ c $> * master
    remotes / origin / HEAD - >起源/大师
    遥控器/原产地/ MyTestBranch
    遥控器/原产地/ ABC
    遥控器/原产地/ XYZ
    遥控器/原产地/ TEST
    $ b
  3. git remote -v

      origin git @ github ..................(fetch)
    origin git @ github .................. 。(推)
    测试https:// abc .................................... .......(取)
    测试https:// abc .............................. .............(推)


  4. git fsck --full

     树中的错误300894f515b714a42efd603f4196d45c8c1f3c09:包含重复的文件条目
    中的错误a84c6e1cc242cdc4c7d7ce5246be02672d1eaf3a:包含重复的文件条目


  5. 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'


  6. git push test master

     计数对象:33396,完成。 
    使用多达2个线程的增量压缩。
    压缩对象:100%(10456/10456),完成。
    写作对象:100%(33396/33396),86.61 MiB | 16.05 MiB / s,完成。
    合计33396(增量17522),重复使用31573(增量17001)
    远程:解析增量:100%(17522/17522)
    远程:计数对象:33396,完成
    远程:更新引用:100%(1/1)
    至https:// abc ............................. .................................... git
    * [new branch] master - > master


  7. git push --mirror test

     计数对象:35959,完成。 
    使用多达2个线程的增量压缩。
    压缩对象:100%(11059/11059),完成。
    写作对象:100%(35631/35631),86.91 MiB | 16.52 MiB / s,完成。
    总计35631(增量19237),重用35489(增量19127)
    远程:解包错误无效树300894f515:重复的项名称
    错误:解包失败:错误无效的树300894f515:重复的项目名称


如何解决此问题?

解决方案

我通过下面提到的步骤解决了问题。


  1. 首先我做了一个--mirror clone。

  2. 然后执行git filter-branch -f --index-filter'git rm -rf --cached --ignore- unmatch SampleApp &&& git ls-files -s | git update-index --index-info'--prune-empty --tag-name-filter cat - --all

  3. 然后我做了一个--mirror push。

这里SampleApp是已经损坏。


I need to push my existing repository to another empty repository in Git. I was getting this following error:

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

After trying several options I was able to rewrite the history and push the master branch finally. But when I am trying to push the --mirror again, it is showing the same error. I am attaching the log here.

  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 test master

    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
    

How to resolve this issue?

解决方案

I resolved the issue with the steps mentioned below.

  1. At first I did a --mirror clone.
  2. Then executed "git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch SampleApp && git ls-files -s | git update-index --index-info' --prune-empty --tag-name-filter cat -- --all"
  3. Then I did a --mirror push.

Here SampleApp is the file that has been corrupted.

这篇关于将--mirror推入Git存储库时出现重复文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆