Git-常见问题集

一、介绍

关于Git的使用,日常中会发生一些比较少见的和常见的问题,本文尽量都会慢慢收录进来。

二、问题集

1.执行git pull命令后,报unable to unpack问题:

D:\xxx>git pull
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Enumerating objects: 33477, done.
error: inflate: data stream error (incorrect header check)
error: unable to unpack 94306b83879f084d65aae729e0b1067690334131 header
Counting objects: 100% (33477/33477), done.
Delta compression using up to 8 threads
Compressing objects: 100% (15401/15401), done.
error: inflate: data stream error (incorrect header check)
error: unable to unpack 94306b83879f084d65aae729e0b1067690334131 header
fatal: loose object 94306b83879f084d65aae729e0b1067690334131 (stored in .git/objects/94/306b83879f084d65aae729e0b1067690334131) is corrupt
fatal: failed to run repack
Already up to date.

报此问题时,删除此分支,并重新checkout,一般还是会报此问题。

分析:看网上其它的解决方式,就是删除.git/objects/94/306b83879f084d65aae729e0b1067690334131文件,并重新pull:

D:\xxx>git pull
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Enumerating objects: 33477, done.
Counting objects: 100% (33477/33477), done.
Delta compression using up to 8 threads
Compressing objects: 100% (15401/15401), done.
fatal: unable to read 94306b83879f084d65aae729e0b1067690334131
fatal: failed to run repack
Already up to date.

前面是unable to unpack 该header文件,删除之后,直接就是unable to read该文件。

其实问题很简单,一般出现此问题都涉及到多分支的切换,无非就是两个分支中,一个节点的冲突导致,如果该冲突节点是最后一个提交节点,执行上述操作应该是没有问题的,但如果该冲突节点不是最新的提交节点,那么直接删除,会导致节点链缺失,仍旧不能解决问题。

解决方法:最简单的一种解决方式,就是重新拉取代码直接切到指定分支(当然解决方式还有很多种,这应该是最简单的一种解决方式了)

上一篇:git push fatal: unable to access 'https://github.com/yxdych/test.git/': OpenSSL SSL_read:


下一篇:docker 运行中的容器CPU 莫名其妙使用率升高过百,解决 :Unable to open socket file: