gpt4 book ai didi

git - 无法推送到 Github : gitmodulesParse: could not parse gitmodules blob

转载 作者:太空狗 更新时间:2023-10-29 14:10:17 25 4
gpt4 key购买 nike

在使用 How do you merge two Git repositories? 中的方法将几个 git 存储库 merge 到 on 之后.我正在将它推送到 Github,但它失败了:

git push -u origin master
Counting objects: 755, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (518/518), done.
Writing objects: 100% (755/755), 29.91 MiB | 1.55 MiB/s, done.
Total 755 (delta 195), reused 481 (delta 128)
remote: error: bad config line 1 in blob .gitmodules
remote: error: object b13fc97cca572d71bf5dad31706d4691bb11a1e7: gitmodulesParse: could not parse gitmodules blob
remote: fatal: fsck error in packed object
error: unpack failed: index-pack abnormal exit
To github.com:...........git
! [remote rejected] master -> master (failed)
error: failed to push some refs to 'git@github.com:...........git'

我手动删除了一些存储库中的一些子模块(rm pathtomodule\.git 然后是 rm .gitmodules)。怎么解决还是没有别的办法,只能remerge? git fsck --full --strict 什么都不给。

最佳答案

我有同样的情况(也 merge 了 repos 和同样的错误)。在我的例子中,一些旧的提交确实包含格式错误的 .gitmodules。由于我们不在 merge 的仓库中使用子模块,而且我什至不关心保留有效的 .gitmodules 我解决问题的方法是简单地删除所有 .gitmodules来自整个历史的文件。注意:这种方法有效地重写了整个历史,保持所有提交不变(减去 .gitmodules),但给它们新的哈希值。

a utility这样做。

或者,如果您想手动执行(几乎是从实用程序中复制的):

git filter-branch --index-filter 'git rm --cached --ignore-unmatch .gitmodules' --force -- --branches --tags
rm -rf .git/refs/original/ .git/refs/remotes/ .git/*_HEAD .git/logs/
(git for-each-ref --format="%(refname)" refs/original/ || echo :) | xargs --no-run-if-empty -n1 git update-ref -d
git reflog expire --expire-unreachable=now --all
git repack -q -A -d
git gc --aggressive --prune=now

关于git - 无法推送到 Github : gitmodulesParse: could not parse gitmodules blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52421573/

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