I recently had a problem with Git on my Mac, and having eventually found the solution I wanted to post here for others.
I’m using git version 1.5.4.5 compiled from source, and I’m on Mac OS X 10.4.11.
Git compiled fine, and *seemed* to work fine. However when pushing or pulling from a remote git repository it reported an error:
[imac:~]$ mkdir git-test
[imac:~]$ cd git-test
[imac:~/git-test]$ git init
Initialized empty Git repository in .git/
[imac:~/git-test]$ touch README
[imac:~/git-test]$ git add README
[imac:~/git-test]$ git commit -m ‘first commit’
Created initial commit b6e6cb6: first commit
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
[imac:~/git-test]$ git remote add origin git@github.com:mkdynamic/git-test.git
[imac:~/git-test]$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 215 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
fatal: final sha1 did not match
error: unpack failed: unpacker exited with error code
To git@github.com:mkdynamic/git-test.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to ‘git@github.com:mkdynamic/git-test.git’
I confirmed that it was not an issue with the remote repository, as I got a similar ‘final sha1 did not match’ errors when I tried to do local fetches.
After tearing my hair out for a few days (plus googling, irc’ing and mailing), I finally found the solution to this problem. Somebody on the git maling list () had the exact same issue previoulsy the posted the solution in response to my earlier post:
I think I had the same problem yesterday. Do you have fink installed?
Specifically the openssl packages? Uninstalling those through fink
and recompiling git did the trick for me, though I’m not sure what the
real problem was.You should also be able to define
NO_FINKas well (see the beginning
of the Makefile).Good luck,
Tarmigan
Following this advice, I removed *all* fink openssl packages (using sudo fink remove openssl) and recompiled Git (without the NO_FINK switch as I’d removed openssl anyway):
./configure –prefix=/usr/local && make all && sudo make install
And low and behold Git now works correctly! So beware of the dodgy SHA-1 implementation that obviously exists within a certain version of the Fink openssl packages.
