Git review :error: unpack failed: error Missing tree

    xiaoxiao2021-03-26  23

    环境

    git version 1.9.1 Gerrit Code Review (2.11.3) 12 12

    现象

    修改后调用 Git review可以提交到Gerrit上,然后只要一用 git commit --amend修改 Commit Message再提交,就会出现此错误;而如果不修改Commit Message,而只是修改增加文件,那么可以用--amend提交再 git review

    error: unpack failed: error Missing tree 8d89499daadf6417347218b630b5cae57e7fa27c fatal: Unpack error, check server log To ssh://user1@review.zjc.com:29418/test-project1.git ! [remote rejected] HEAD -> refs/publish/master (n/a (unpacker error)) error: failed to push some refs to 'ssh://user1@review.zjc.com:29418/test-project1.git' 12345 12345

    解决方案

    经过多方查资料,是提交时的 thin push 的问题,默认是开着的,要把它关掉

    有人说

    在工程的 .gitreview 下的 Gerrit节点下增加 disablethinpush=true在 /etc/git-review/git-review.conf 中添加 disablethinpush=true用 git push --no-thin ...来解决,因为这是一个BUG涉及到库更改时候有未关闭的的patch,更新gerrit的数据库

    好吧,我承认在Git使用上我是菜鸟,我只是用 git review来提交而已。捣鼓了半天上面的N种列出来没列出来的解决方案,都失败

    好吧,说出来我碰巧得到的一个这种方案

    执行命令git review --no-thin :失败  无意间看到 git review -h 有个命令行参数 -n  执行命令git review -n : 

    Please use the following command to send your commits to review: git push gerrit HEAD:refs/publish/master

    执行 git push gerrit HEAD:refs/publish/master : 还是那个错误

    执行 git push --no-thin gerrit HEAD:refs/publish/master

    成功了!!!!

    好吧,我笨 && 牛人的世界我不懂

    结论

    加一个结论吧,啰嗦一大堆,其实就2句话是关键  执行 git review,如果出现错误就执行git push --no-thin gerrit HEAD:refs/publish/master

    参考

    https://libraries.io/github/savoirfairelinux/git-review  https://bugs.launchpad.net/git-review/+bug/1332549  http://www.cnblogs.com/qingliuyu/p/4510233.html

    转载请注明原文地址: https://ju.6miu.com/read-664051.html

    最新回复(0)