我需要将现有的存储库推送到Git中的另一个空存储库。我收到以下错误:
remote: unpack error Invalid tree 300894f515: duplicate entry names
error: unpack failed: error Invalid tree 300894f515: duplicate entry names
在尝试了几个选项后,我能够重写历史记录并最终推送主分支。但是当我试图再次推动--mirror
时,它显示的是同样的错误。我在这里附上日志。
git clone URL
git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/MyTestBranch
remotes/origin/ABC
remotes/origin/XYZ
remotes/origin/TEST
git remote add test REMOTE URL
git remote -v
origin git@github.................. (fetch)
origin git@github................... (push)
test https://abc........................................... (fetch)
test https://abc........................................... (push)
git fsck --full
error in tree 300894f515b714a42efd603f4196d45c8c1f3c09: contains duplicate file entries
error in tree a84c6e1cc242cdc4c7d7ce5246be02672d1eaf3a: contains duplicate file entries
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'
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
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
如何解决此问题?
答案 0 :(得分:1)
我通过下面提到的步骤解决了这个问题。
此处SampleApp是已损坏的文件。
答案 1 :(得分:0)
您的重写历史记录位于cordova run android
(即refs/heads/master
分支)。但master
将在filter-branch
中创建已损坏历史记录的备份。你的refs/original/refs/heads/master
推送会发送,导致对方抱怨。
您可能想要--mirror
。