Installing gitolite on a Mac

I’ve come to love gitolite for hosting private git repositories. It’s very easy to administer and trouble-free.

On one project, I needed to share a very large git repository between two virtual machines. I didn’t want the overhead of using a private git repository out on the Internet, just something local, like my workstation that runs OS X.

I used the System Preferences to create an account named git, and followed the gitolite install instructions.

I ran into a couple of problems that were easily resolved.

Path for Installer

First, to address gitolite complaining about not being able to find itself, I created a .bash_profile with the following:

[bash light=”true”]
export PATH=/Users/git/bin:$PATH

Now I could run the gitolite install cleanly. I would recommend doing this first thing after creating the git account to host gitolite.

Help gitolite Find git

I installed git from the link on the front page of the git web site. This installs git in /usr/local/git/bin, which gitolite doesn’t like out of the box. The fix is easy. When gitolite installs, it brings up the config file (~/.gitolite.rc) in an editor for you to tweak.

Find the line

[bash light=”true”]

and change it to

[bash light=”true”]

This will prevent error messages such as

[bash light=”true”]
$ ssh git@localhost
PTY allocation request failed on channel 0
Can’t exec “git”: No such file or directory at /Users/git/bin/ line 562.
Use of uninitialized value $git_version in substitution (s///) at /Users/git/bin/ line 563.
hello Yourkey, this is gitolite v2.2-4-the gitolite config gives you the following access:
Use of uninitialized value $git_version in concatenation (.) or string at /Users/git/bin/ line 564.
R W gitolite-admin
@R_ @W_ testing
Connection to localhost closed.

from appearing and preventing gitolite from working.

Update 1 September 2013

These instructions seem to still work with gitolite 3, with additional commentary:

If you ssh into your OS X machine, you might see the message:

[bash light=”true”]
$ ssh git@localhost
PTY allocation request failed on channel 0

gitolite is still working. There is simply a collision between ssh versions. You an get a list of the repositories you’re allowed to access by one of these two commands:

[bash light=”true”]
$ ssh -T git@localhost
$ ssh git@localhost info

5 thoughts on “Installing gitolite on a Mac

  1. greg

    Hey there,

    I was having the exact same issue you’re mentioning. The git user’s PATH was fine, so I thought I’d edit the .gitolite.rc file to point gitolite to the git binaries (even though they were already on the PATH in my case).

    Still no luck. The way I understand it, it should work even if I edit the file *after* the install, right ? Any clue ?

  2. greg

    Nevermind my previous comment, I misread your GIT_PATH as set to ../bin/git instead ../git/bin, so I wrongly set mine to “/opt/local/bin/git” instead of “/opt/local/bin” which now works.

    Thanks for the article !

  3. Manish

    Thanks for doing this. I have been facing similar issues (Mac OSX 10.7.4 & Xcode 4.3.3) after installing (using instructions @, except, I cannot find $GIT_PATH in the config file (~/.gitolite.rc). I am using Gitolite v3.0 and install does not bring it up either. When I try to clone, I get the following error:

    Can’t exec “git”: No such file or directory at (blah… blah… blah)

    Finally, I found this link ( Installing “XCode Command Line Tools” did the trick for me. I’m now able to “ssh git@myhost info” and see info telling me sanity prevails. Thanks!

Leave a Reply