推送到 SCM 管理器时出现 Git 解包错误
Posted
技术标签:
【中文标题】推送到 SCM 管理器时出现 Git 解包错误【英文标题】:Git unpack error on push to SCM Manager 【发布时间】:2016-02-24 18:13:10 【问题描述】:我们的几个存储库最近开始在推送时抛出解包错误:
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 288 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
error: unpack failed: error Short read of block.
To http://git:8080/scm/git/Sandbox
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'http://git:8080/scm/git/Sandbox'
SCM 管理器日志显示的错误似乎与上述相符:
2016-02-24 17:54:39.483 [qtp1967563673-16] ERROR org.eclipse.jgit.internal.storage.file.ObjectDirectory - ERROR: Exception caught while accessing pack file /var/lib/scm/repositories/git/Sandbox/objects/pack/pack-00aca3dbe856f7f3f7e730a00a1dae29aa7f8070.pack, the pack file might be corrupt
java.io.EOFException: Short compressed stream at 533
at org.eclipse.jgit.internal.storage.file.PackFile.decompress(PackFile.java:341) ~[org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.PackFile.load(PackFile.java:734) ~[org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.PackFile.get(PackFile.java:259) ~[org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedObject(ObjectDirectory.java:417) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openPackedFromSelfOrAlternate(ObjectDirectory.java:386) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.ObjectDirectory.openObject(ObjectDirectory.java:378) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:145) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:840) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at org.eclipse.jgit.revwalk.RevWalk.parseTree(RevWalk.java:780) [org.eclipse.jgit-3.7.1.201504261725-r-scm1.jar:3.7.1.201504261725-r-scm1]
at sonia.scm.repository.spi.GitBrowseCommand.getResult(GitBrowseCommand.java:325) [scm-git-plugin-1.46.jar:na]
at sonia.scm.repository.spi.GitBrowseCommand.getBrowserResult(GitBrowseCommand.java:147) [scm-git-plugin-1.46.jar:na]
at sonia.scm.repository.api.BrowseCommandBuilder.getBrowserResult(BrowseCommandBuilder.java:174) [scm-core-1.46.jar:na]
at sonia.scm.api.rest.resources.RepositoryResource.getBrowserResult(RepositoryResource.java:564) [classes/:na]
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09-icedtea]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09-icedtea]
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) [jersey-server-1.19.jar:1.19]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) [jersey-servlet-1.19.jar:1.19]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) [jersey-servlet-1.19.jar:1.19]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) [jersey-servlet-1.19.jar:1.19]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) [javax.servlet-2.5.0.v201103041518.jar:na]
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.filter.MDCFilter.doFilter(MDCFilter.java:96) [classes/:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.filter.SecurityFilter.doFilter(SecurityFilter.java:111) [classes/:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.web.filter.BasicAuthenticationFilter.processRequest(BasicAuthenticationFilter.java:423) [scm-core-1.46.jar:na]
at sonia.scm.web.filter.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:214) [scm-core-1.46.jar:na]
at sonia.scm.web.security.ApiBasicAuthenticationFilter.doFilter(ApiBasicAuthenticationFilter.java:116) [classes/:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.filter.GZipFilter.doFilter(GZipFilter.java:112) [scm-core-1.46.jar:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.web.filter.AutoLoginFilter.doFilter(AutoLoginFilter.java:87) [scm-core-1.46.jar:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at sonia.scm.filter.BaseUrlFilter.doFilter(BaseUrlFilter.java:117) [classes/:na]
at sonia.scm.web.filter.HttpFilter.doFilter(HttpFilter.java:102) [scm-core-1.46.jar:na]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.2.3.jar:1.2.3]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.2.3.jar:1.2.3]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.3.jar:1.2.3]
at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) [guice-servlet-3.0.jar:na]
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) [guice-servlet-3.0.jar:na]
at sonia.scm.boot.BootstrapFilter.doFilter(BootstrapFilter.java:119) [classes/:na]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1288) [jetty-servlet-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:443) [jetty-servlet-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556) [jetty-security-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372) [jetty-servlet-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.Server.handle(Server.java:369) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:933) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:995) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) [jetty-http-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) [jetty-server-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) [jetty-io-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) [jetty-io-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) [jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) [jetty-util-7.6.16.v20140903.jar:7.6.16.v20140903]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_09-icedtea]
有趣的是,原生 git 似乎对这些存储库没有任何问题。我仍然可以克隆它们,git log
显示的它们的历史似乎完好无损。如果我使用git clone --bare
创建一个本地副本并将其设置为我的远程,我可以成功推送到这个本地副本。
git fsck
显示了两个悬空提交和一个悬空标签,在 git gc
之后消失了。但是,这并没有解决问题。
我尝试过使用git push --no-thin
,基于例如git unpack error on push to gerrit,但得到了和上面一样的错误。
我还尝试在 SCM 管理器端创建一个新的空存储库,并将其设置为有问题的存储库的本地副本的远程。初始推送似乎成功,但任何进一步推送到新存储库都会导致相同的错误。
由于使用本机 git 的本地推送仍然有效,在我看来,这些存储库应该是可以挽救的。但我不知道如何进行。任何关于修复这些存储库或尽可能多地挽救其历史的想法将不胜感激。
【问题讨论】:
看起来像一个 jgit 错误,它是 SCM-Manager 使用的库。您使用的是最新版本的 SCM-Manager 吗? 【参考方案1】:我遇到了同样的问题,并通过添加一个新的提交来修复它(在评论中提交一个额外的点:))。
我的错误信息:
C:\Users\313373\Documents\Git\myproj>git push
Username for 'xyz': 313373
Password for 'xyz':
Enumerating objects: 85, done.
Counting objects: 100% (84/84), done.
Delta compression using up to 4 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (40/40), 4.65 KiB | 153.00 KiB/s, done.
Total 40 (delta 14), reused 0 (delta 0)
error: remote unpack failed: error Short read of block.
To https://remoteurl......redacted
! [remote rejected] develop -> develop (n/a (unpacker error))
error: failed to push some refs to REPONAME
【讨论】:
我讨厌这行得通。因为它可以工作,但它并没有解决 SCM Manager 的问题, 是的,但我无法确定有关该问题的详细信息,也无法重现它。如果您有日志,也许可以提交错误报告。【参考方案2】:我遇到了同样的问题,对我来说,我正在推送一个中继大文件。 忽略这个文件解决了我的问题。
【讨论】:
以上是关于推送到 SCM 管理器时出现 Git 解包错误的主要内容,如果未能解决你的问题,请参考以下文章
使用 Eclipse DDMS 将大文件推送到模拟器/SD 卡时出现问题
VS团队资源管理器(VS自带git)使用说明_使用VS自带git推送到远程存储库