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:

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


and change it to


This will prevent error messages such as

$ 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:

$ 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:

$ ssh -T git@localhost
$ ssh git@localhost info
This entry was posted in Mac and tagged , , , , . Bookmark the permalink.

5 Responses to Installing gitolite on a Mac

  1. greg says:

    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 says:

    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. I’m glad you found it helpful, Greg. 🙂

  4. Manish says:

    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!

  5. Manish, thanks for the tip.

Leave a Reply