setting the PATH for Git (not for me)

Posted by Iain on Server Fault See other posts from Server Fault or by Iain
Published on 2011-03-06T14:40:43Z Indexed on 2011/03/06 16:11 UTC
Read the original article Hit count: 247

Filed under:
|

Hi,

I'm running OSX 10.6.5 with Git 1.7.1

I have git installed in a non-standard location (though that really should be the standard on a mac;-) in /Library/Frameworks/Git.framework. My own PATH is set fine, git works fine, until... I set up a pre-commit hook with a Ruby script:

$ git commit -m "added some Yard documentation"
.git/hooks/pre-commit: line 1: #!/usr/bin/env: No such file or directory

The pre-commit.sample runs ok, so it appears that git can't find /usr/bin/env, or much else as I've tried shebanging it directly to ruby etc. Just /bin/sh is ok.

So, where does Git get it's PATH? because it's not using mine or this wouldn't be happening. And more to the point, how do I get it to see /usr/bin/env ?

I've tested the ruby script already, it works.


Just to add:

$ cat /etc/paths                    
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

$ cat /etc/paths.d/git
/Library/Frameworks/Git.framework/Programs

The first few lines of the Ruby script (which runs via ./pre-commit or ruby pre-commit)

#!/usr/bin/env ruby -wKU

class String
  def expand_path
    File.expand_path self
  end

  def parent_dir
    File.dirname self.expand_path
  end
end

© Server Fault or respective owner

Related posts about macosx

Related posts about git