Export to GitHub

git-osx-installer - issue #8

git fails out-of-the-box due to .git/hooks/pre-commit issues


Posted on May 16, 2008 by Helpful Cat
  • install git from git-1.5.5.1-osx-leopard-intel.dmg
  • enter a clean directory and touch a file
  • git init
  • git commit (or git commit -a)

The error is

fatal: exec /Users/tom/Documents/Max/.git/hooks/pre-commit failed.

(where /Users/tom/Documents/Max is my clean directory).

There doesn't seem to be anything wrong in that directory: it contains a list of scripts that are marked -x, with instructions to make them +x if you want them executed. This same mechanism works on a different version of Git on Linux.

A workaround is to simply move these files into a subdirectory of this pre-commit directory or of course to delete them entirely:

cd <your-directory/.git/hooks/pre-commit mkdir SAVED mv - SAVED

A suggested patch is to not put these files in this place a standard .git installation for Mac OS/X with a README explaining where to find the files and how to use them.

A suggested fix for this would be to look at the main Git codebase and see why it doesn't seem to understand that these files are -x.

Comment #1

Posted on May 16, 2008 by Swift Wombat

I can't reproduce this.

First: would you please run and post the results of "ls -l /usr/local/git/share/git-core/templates/hooks"

Then, can you try to rm -rf /usr/local/git, and then reinstall, and see if it fixes your issue?

The problem may be somehow the permissions of the files in /usr/local/git/share/git-core/templates/hooks are executable - when they shouldn't be.

Tim

Comment #2

Posted on May 16, 2008 by Helpful Cat

Bafflingly enough, when I removed and reinstalled it worked fine. I installed completely by the book both times, no fiddling!

Strange. I definitely observed this but you can mark it as "can't reproduce".

I listed the hooks directory before and after, it was exactly the same (see below).

bash-3.2$ ls -l /usr/local/git/share/git-core/templates/hooks total 88 -rw-rw-r-- 1 root wheel 441 Apr 20 18:17 applypatch-msg -rw-rw-r-- 1 root wheel 887 Apr 20 18:17 commit-msg -rw-rw-r-- 1 root wheel 152 Apr 20 18:17 post-commit -rw-rw-r-- 1 root wheel 510 Apr 20 18:17 post-receive -rw-rw-r-- 1 root wheel 207 Apr 20 18:17 post-update -rw-rw-r-- 1 root wheel 387 Apr 20 18:17 pre-applypatch -rw-rw-r-- 1 root wheel 1706 Apr 20 18:17 pre-commit -rw-rw-r-- 1 root wheel 4262 Apr 20 18:17 pre-rebase -rw-rw-r-- 1 root wheel 1180 Apr 20 18:17 prepare-commit-msg -rw-rw-r-- 1 root wheel 2910 Apr 20 18:17 update

Sorry to bother you!

Comment #3

Posted on May 16, 2008 by Swift Wombat

You're fine :) Thanks for the feedback. I answer in a hurry sometimes because I'm very busy, and it may come across as I'm being bothered.

Have a great day!

Status: Invalid

Labels:
Type-Defect Priority-Medium