Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

git - Getting fatal: object is corrupted when pushing to a remote repo

I've got a server with Gitolite installed to host my repos I created a new repo yesterday and today when I tried to push more commits to the server I am getting:

fatal: object 86eeaa0c5a154ff3df34d6a43669930b9c6c7f59 is corrupted
error: unpack failed: unpack-objects abnormal exit
error: failed to push some refs to

As the repo is pretty new I wasn't too bothered about losing previous commits so I have deleted both my local and remote repo but still getting the same error.

As I say I'm not too concerned about maintaing my commit history, I would just like to get it working again!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As seen in the comments, any additional repo has an issue during its creation (ie when pushing back the gitolite-admin repo with the gitolite.conf file declaring a new repo)

I didn't notice this before but when I create a new repo I'm getting the following error:

remote: line 1 too long: command="/home/git/gitolite/src/gitolite... 
remote: FATAL: fingerprinting failed for /tmp/Cdug9Itivq 

But it's creating the repo in /home/git/repositories

This operation takes place in a post-compilation trigger called ssh-authkeys:

sub fp_file {
    return $selinux++ if $selinux; # return a unique "fingerprint" to prevent noise
    my $f = shift;
    my $fp = `ssh-keygen -l -f '$f'`;
    chomp($fp);
    _die "fingerprinting failed for '$f'" unless $fp =~ /([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f])+)/;
    $fp = $1;
    return $fp;
}

That means ssh-keygen -l -f <path_to_public_key.pub> doesn't follow the right pattern, as shown in "self service key management".

Make sure that your key is generated like:

ssh-keygen -t rsa -f "${H}/.ssh/git" -C "Gitolite Admin access (not interactive)" -q -P ""

Update April 2015:

As mentioned by starfry in "Gitolite - remote: FATAL: fingerprinting failed for 'keydir/'":

There was a change to the key fingerprint format in OpenSSH at version 6.8:

Add FingerprintHash option to ssh(1) and sshd(8), and equivalent command-line flags to the other tools to control algorithm used for key fingerprints. The default changes from MD5 to SHA256 and format from hex to base64.

Fingerprints now have the hash algorithm prepended.
An example of the new format:

SHA256:mVPwvezndPv/ARoIadVY98vAC0g+P/5633yTC4d/wXE

Please note that visual host keys will also be different.

The latest git checkout of gitolite is aware, since 18th March '15, of this new format.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...