My git, gitolite and homebrew adventure
Suddenly, one day git seemed to be broken out of nowhere.
My gitolite instalation was no longer functional, showing an error
$ git push origin master
Assertion failed: (argv0_path), function system_path, file exec_cmd.c, line 27.
error: git-shell died of signal 6
fatal: The remote end hung up unexpectedly
I tried reinstalling gitolite, to no avail.
Weirdly, the problem seemed to be fixed by adding the following line to .bashrc
export GIT_EXEC_PATH=/opt/local/libexec/git-core
It didn’t make sense at all. This wasn’t needed before and was unlikely to be a requirement of git 1.7.4.1 which I had recently updated to.
However that fixed gitolite so I got on to coding.
The following day, the strange behavior returned
$ git pull
git: 'pull' is not a git command. See 'git --help'.
Did you mean this?
shell
What? What do you mean pull is not a git command? Clearly something was wrong. Which version am I on?
$ git --version
git version 1.7.3.4
Aha! So the version is not the latest I got from homebrew. Why?
$ which git
/usr/bin/git
Did someone enter my computer at night and install git on /usr/bin instead of /usr/local/bin? Clearly I was missing something. Then it hit me. I had installed recently XCode 4 which includes git. This could probably be the root of the problem and explained it all definetly. I uninstalled git from homebrew
$ brew uninstall git
$ brew cleanup
So now to step one, GIT_EXEC_PATH was still undefined, I just needed to define it with the right directory. Fortunately a find located the correct libexec/git-core folder.
export GIT_EXEC_PATH=/usr/libexec/git-core
And everything is now back to normal.