推送到 gerrit 时出现 git 解包错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16586642/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:10:41  来源:igfitidea点击:

git unpack error on push to gerrit

gitpushgerritunpack

提问by edlerd

On push of a new branch to a gerrit server we encounter the following error:

在将新分支推送到 gerrit 服务器时,我们遇到以下错误:

de@roma:~/git-hate/www$ git push origin landingpage
Counting objects: 149, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (73/73), done.
Writing objects: 100% (111/111), 2.77 MiB, done.
Total 111 (delta 68), reused 80 (delta 38)
remote: Resolving deltas: 100% (68/68)
error: unpack failed: error Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361
fatal: Unpack error, check server log
To ssh://user@git-server/repository
 ! [remote rejected] landingpage -> landingpage (n/a (unpacker error))
error: failed to push some refs to 'ssh://user@git-server/repository'

We tried to copy the mentioned tree object to the remote git manually without success.

我们尝试手动将提到的树对象复制到远程 git,但没有成功。

On gerrit side we get a stacktrace:

在gerrit方面,我们得到一个堆栈跟踪:

[2013-05-16 13:43:42,753] ERROR com.google.gerrit.sshd.BaseCommand : Internal server error (user de account 1000000) during git-receive-pack '/repository'
com.google.gerrit.sshd.BaseCommand$Failure: fatal: Unpack error, check server log
        at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:157)
        at com.google.gerrit.sshd.AbstractGitCommand.service(AbstractGitCommand.java:106)
        at com.google.gerrit.sshd.AbstractGitCommand.access
git push --no-thin omnigerrit HEAD:refs/for/android-4.4
0(AbstractGitCommand.java:34) at com.google.gerrit.sshd.AbstractGitCommand.run(AbstractGitCommand.java:72) at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:430) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:165) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:337) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.io.IOException: Unpack error on project "repository": AdvertiseRefsHook: org.eclipse.jgit.transport.AdvertiseRefsHookChain@7047125class org.eclipse.jgit.transport.AdvertiseRefsHookChain at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:156) ... 13 more Caused by: org.eclipse.jgit.errors.UnpackException: Exception while parsing pack stream at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:202) at org.eclipse.jgit.transport.ReceivePack.receive(ReceivePack.java:142) at com.google.gerrit.sshd.commands.Receive.runImpl(Receive.java:98) ... 13 more Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing tree 30c4809ade0b4b0c81cb7f882450774862b82361 at org.eclipse.jgit.transport.BaseReceivePack.checkConnectivity(BaseReceivePack.java:996) at org.eclipse.jgit.transport.BaseReceivePack.receivePackAndCheckConnectivity(BaseReceivePack.java:756) at org.eclipse.jgit.transport.ReceivePack.service(ReceivePack.java:167) ... 15 more

Folks: any ideas what to do?

伙计们:有什么想法要做什么吗?

回答by Tassadar

Pushing with --no-thinargument works as a workaround for me:

--no-thin参数推动对我来说是一种解决方法:

Internal server error (user newptone account 1) during git-receive-pack                           '/neutron.git' 
com.google.gerrit.sshd.BaseCommand$Failure: fatal: Unpack error,   check server log
......
... Missing unknown 613fd2557fba30aff2dbd51c3807cc57561bab08

回答by tardyp

Are you using git > 1.8.4.2 ?

你在使用 git > 1.8.4.2 吗?

I found incompatibility between git 1.8.4.3+ and gerrit 2.6, because of https://github.com/git/git/commit/fbd4a7036dfa71ec89e7c441cef1ac9aaa59a315

我发现 git 1.8.4.3+ 和 gerrit 2.6 之间不兼容,因为 https://github.com/git/git/commit/fbd4a7036dfa71ec89e7c441cef1ac9aaa59a315

With this enhancement, if git finds out that the tree sha1 already exists in the server, it wont send it again, but gerrit wants to search the tree sha1 associated with the commit sha1 in the uploaded pack.

通过这个增强,如果 git 发现服务器中已经存在树 sha1,它不会再次发送它,但是 gerrit 想要搜索与上传包中的提交 sha1 关联的树 sha1。

It looks like I cannot reproduce it with gerrit 2.8-rc3, not with latest version of scm-manager. I would say this has been resolved in jgit, but cannot find which version yet.

看起来我无法使用 gerrit 2.8-rc3 重现它,而不是使用最新版本的 scm-manager。我会说这已经在 jgit 中解决了,但还找不到哪个版本。

回答by NewPtone

my case

我的情况

I also encounter this problem too, and this take a long time to fix this problem.

我也遇到了这个问题,这需要很长时间才能解决这个问题。

First, I notice one error info in gerrit log:

首先,我在 gerrit 日志中注意到一个错误信息:

1974  master  Add two interfaces for manipulate forwarding individually

What is 613fd2557fba30aff2dbd51c3807cc57561bab08 object?

什么是 613fd2557fba30aff2dbd51c3807cc57561bab08 对象?

Then I use git review -l to search all opened patchset for this project neutron:

然后我使用 git review -l 来搜索这个项目 neutron 的所有打开的补丁集:

613fd2557fba30aff2dbd51c3807cc57561bab08 cannot  found

Then I find this patchset in gerrit dashboard by searching, I click the link and it seems error:

然后我通过搜索在 gerrit 仪表板中找到了这个补丁集,我点击了链接,它似乎是错误的:

select * from changes where change_id=1974\G;

Aha, that's the reason!

啊哈,就是这个原因!

But why this object missing?

但是为什么这个对象不见了?

The reason is my colleague tell me neutron project will use a new repo to replace the old, I delete the the old repo but didn't close all open patchset in gerrit. The open patchset will disappear in gerrit dashboard, but it still exist in gerrit database.

原因是我的同事告诉我 neutron 项目将使用新的 repo 来替换旧的,我删除了旧的 repo 但没有关闭 gerrit 中所有打开的补丁集。打开的补丁集将在 gerrit 仪表板中消失,但它仍然存在于 gerrit 数据库中。

how to fix it

如何修复它

Login in your reviewdb sql and find this record:

登录您的 reviewdb sql 并找到此记录:

First, make sure this is the one we want to modify:

首先,确保这是我们要修改的:

update changes set open='N',status='A' where change_id=1974;

Then update this record:

然后更新这个记录:

git remote add gerrit GERRIT_GIT_PROJECT_URL
git fetch gerrit
And then upload again.

回答by Andy Obusek

I just encountered this error as well.

我刚刚也遇到了这个错误。

For my scenario, I was attempting to push an amended commit where none of the files had changed since the last time the same commit was pushed. I literally had just amended the commit message for the change, and attempted to push again. No files as part of the commit changed.

对于我的场景,我试图推送修改后的提交,其中自上次推送相同提交以来没有任何文件发生更改。我刚刚修改了更改的提交消息,并尝试再次推送。作为提交的一部分,没有文件更改。

My push was rejected with the same error message you posted.

我的推送被拒绝,错误消息与您发布的相同。

It seemed that Gerrit did not like a push with no changes other than the amended commit message.

Gerrit 似乎不喜欢推送,除了修改后的提交消息之外没有任何更改。

I literally made a one character change to a file, added the file, amended the commit again, and pushed, and the push succeeded.

我真的对文件进行了一个字符更改,添加了文件,再次修改提交,然后推送,推送成功。

I'm using git == 1.8.4.2

我正在使用 git == 1.8.4.2

回答by obrienk

I had this problem today and tried all the suggestions. Finally the solution was very simple:

我今天遇到了这个问题并尝试了所有建议。最后解决方法很简单:

  1. Switch to another branch (e.g. develop).
  2. Pull from the remote repository
  3. Switch back to your new branch and push.
  1. 切换到另一个分支(例如开发)。
  2. 从远程仓库拉取
  3. 切换回你的新分支并推送。

With any luck it'll work now.

运气好的话,它现在可以工作了。

回答by onlywei

I encountered this issue today and I was not using git > 1.8.4.2. I am on Gerrit 2.7.

我今天遇到了这个问题,我没有使用 git > 1.8.4.2。我在 Gerrit 2.7 上。

After around 5 minutes of frustration, I decided to just switch to the local version of the branch I was trying to push to and I did a pull. After that, my pushes started working again but I do not understand why.

经过大约 5 分钟的沮丧之后,我决定切换到我试图推送到的分支的本地版本,然后我做了一个拉取。在那之后,我的推送又开始工作了,但我不明白为什么。

回答by Chunlin Zhang

I just come with this issue just now,and my case is: Some one git init and push a whole new branch (that is to say,this branch is no relation with any revision in origin git in gerrit) to a git project in gerrit. I try many way but fail. In the end I am inspired by the answer of @obuseme ,follow this and fixed:

我刚刚遇到了这个问题,我的情况是:某个 git init 并将一个全新的分支(也就是说,该分支与 gerrit 中的原始 git 中的任何修订没有关系)推送到 gerrit 中的 git 项目. 我尝试了很多方法但失败了。最后,我受到@obuseme 的回答的启发,请按照以下步骤进行修复:

git config --global --unset user.name
git config --global --unset user.email
git config --global --unset credential.helper

回答by Max Hohenegger

I worked around this issue by re-cloning the repository, and copying my changes over from the old one.

我通过重新克隆存储库并从旧存储库复制我的更改来解决此问题。

The other solutions did not work for me, except I did not try obrienks.

其他解决方案对我不起作用,除非我没有尝试 obrienks。

I tried with git 2.6.1 as well as with JGit 4.6.1, and I use Gerrit 2.13.1.

我尝试过 git 2.6.1 和 JGit 4.6.1,我使用 Gerrit 2.13.1。

回答by Frank Forte

When you get the unpack error, you might want to look for this line as well: remote: error: unable to create temporary file: No space left on device

当您收到解包错误时,您可能还想查找这一行: remote: error: unable to create temporary file: No space left on device

Deleting a couple of old backup files freed up enough space to get it working again.

删除几个旧的备份文件释放了足够的空间让它再次工作。

回答by Elakya

When I encountered this problem, it was with authentication. My password had expired.

当我遇到这个问题时,它与身份验证有关。我的密码已过期。

So tried unsetting the GitHub credentials from config using the commands below:

因此,尝试使用以下命令从配置中取消设置 GitHub 凭据:

##代码##

After this, pushworked without any problem.

在此之后,push工作没有任何问题。