如果我从远程
获取提取,则会出现以下错误$ git pull
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 85 (delta 63), reused 69 (delta 48)
Unpacking objects: 100% (85/85), done.
error: inflate: data stream error (unknown compression method)
fatal: failed to read object 8b0fd4094630fea108b60faa15535ffbc85d87cb: Invalid argument
error: http://myremoterepo.com/project.git did not send all necessary objects
我可以在本地提交。当我检查状态时:
> $ git status On branch vikas Your branch is based on 'origin/master',
> but the upstream is gone. (use "git branch --unset-upstream" to
> fixup) nothing to commit, working directory clean
答案 0 :(得分:44)
最后我能解决这个问题。 我认为由于停电导致我的电脑关机时发生了问题。
我能够在任何本地分支中提交任何更改。这意味着我的包文件没有损坏,但有些引用无效。
首先备份.git
。然后我使用git fsck
命令
$ git fsck --full
error: inflate: data stream error (unknown compression method)
error: unable to unpack 38fe6f16c7e8246d61150f0bc42629dbb532b5ce header
error: inflate: data stream error (unknown compression method)
fatal: loose object 38fe6f16c7e8246d61150f0bc42629dbb532b5ce (stored in .git/objects/38/fe6f16c7e8246d61150f0bc42629dbb532b5ce) is corrupt
我删除了文件.git/objects/38/fe6f16c7e8246d61150f0bc42629dbb532b5ce
并继续执行这些步骤,直到我得到以下输出:
$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (168543/168543), done.
error: refs/remotes/origin/staging: invalid sha1 pointer 0000000000000000000000000000000000000000
error: refs/remotes/origin/development: invalid sha1 pointer 0000000000000000000000000000000000000000
error: refs/remotes/origin/master: invalid sha1 pointer 0000000000000000000000000000000000000000
error: bad ref for refs/remotes/origin/staging
broken link from commit 8b0fd4094630fea108b60faa15535ffbc85d87cb
to commit bac9f287963b1abb9e4b376b44b4a6500018e9fe
Checking connectivity: 169821, done.
dangling blob 750718546640b5b14c19cbdb9958d7bcc4b1114c
dangling blob e313786318d4c76004728f15a25c6fa68c88b67e
dangling blob ee3fd85992b48173f6c344a9f4a2f9667d4e1940
dangling blob cd4898a3ec525e559292337c0bc6b68a77270b52
dangling blob 9973506f35af1bf4e7790be57b02c70852843f92
dangling blob 47ca4080b9a528efe23c9f7dce994815f5f9162a
dangling blob 39d6807d215a7e74fb987d951a90e1d3e24a97eb
dangling blob c0d650286c3702d56b827eded27eaa9515212847
dangling commit 53db70d776ec7a59c10db106ef2585abea1ffddd
...
现在我删除了所有三个引用(.git/refs/remotes/origin/master
,.git/refs/remotes/origin/staging
,.git/refs/remotes/origin/development
)
瞧!现在我能够拉动和推动!
P.S。从here
学习答案 1 :(得分:0)
运行Malwarebytes
时出现此错误。 PC重新启动没有帮助。不过,停止Malwarebytes
进程可以解决此问题。因此,请尝试禁用/停止病毒扫描程序,因为这也可能导致此问题。