Created
December 27, 2009 15:53
-
-
Save mr-rock/264304 to your computer and use it in GitHub Desktop.
This is the steps I followed in order to install Gitosis on my Snow Leopard Server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These are the things I did in order to have Gitosis installed and working on my Snow Leopard Server: | |
1. Install Git. | |
I use the installer for OS X provided by Google Code (http://git-osx-installer.googlecode.com/files/git-1.6.5.7-intel-leopard.dmg). | |
2. Install Gitosis | |
I got the Gitosis from the eagain.net server and I installed using Python bundled with Snow Leopard. | |
$ git clone git://eagain.net/gitosis.git | |
$ cd gitosis && python setup.py install | |
3. Create the Git user and Git group. | |
I created a unix user and group for git, using dscl (Snow Leopard's Directory Service CLI). | |
First, I looked for unused user identifier (uid) and group identifier (gid): | |
$ sudo dscl . list /Users uid (for example, 999 is unused) | |
$ sudo dscl . list groups gid (for example, 1024 is unused) | |
Then I created the Git group: | |
$ sudo dscl . create groups/git | |
$ sudo dscl . create groups/git gid 999 | |
Then I created the Git user: | |
$ sudo dscl . create users/git | |
$ sudo dscl . create users/git uid 1024 | |
$ sudo dscl . create users/git NFSHomeDirectory /Users/git | |
$ sudo dscl . create users/git gid 999 | |
$ sudo dscl . create users/git UserShell /bin/bash | |
$ sudo dscl . create users/git Password '*' | |
Finally, I created the home directory for the Git user (defined above): | |
$ sudo mkdir /Users/git | |
$ sudo chown git:git /Users/git | |
4. Create a SSH key for the Gitosis administrator. | |
In order to configure Gitosis, you're required to define an administrator (in this case, myself) so you need to create a SSH key for this guy to do the job (in the case the SSH key haven't been created before): | |
$ ssh-keygen -t rsa -C "[email protected]" | |
Then you are required to fill where you want this key to be created (just use the default option). Then define a password and, finally, confirm it. | |
After this SSH is created, leave the public key available on the /tmp directory in order to use it later. | |
In the case your Gitosis server and your development machine are the same: | |
$ cp ~/.ssh/id_rsa.pub /tmp/xxx.pub | |
Otherwise, you should copy the key to your remote server: | |
$ scp ~/.ssh/id_rsa.pub [email protected]:/tmp/xxx.pub | |
5. Initialize your Gitosis server. | |
Now you should initialize and setup your Gitosis server using the SSH key previously created: | |
$ sudo -H -u git gitosis-init < /tmp/xxx.pub | |
Then, you should make sure that the path to Git are properly set (for both Git and Gitosis) by creating a .bashrc on the Git's home directory with the following content: | |
-- ~/.bashrc | |
export PATH=$PATH | |
export PATH=$(git --exec-path):$PATH | |
-- EOF | |
Finally, you should make executable the post-update hook of the Gitosis-Admin. The default Python install is using an old version of the setuptools so you should do this manually: | |
$ sudo chmod 755 /Users/git/repositories/gitosis-admin.git/hooks/post-update | |
6. Setup your Gitosis server. | |
Now you should be able to clone the gitosis-admin repository from your server: | |
$ git clone [email protected]:gitosis-admin.git | |
This repository contains all the files needed to create repositories for your projects, add new users, and defined access rights. So go ahead and edit the settings at will, commit, and push. Once pushed, gitosis will immediately make your changes take effect on the server. | |
For more information on how to setup your Gitosis server, please go this page (http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way) and read it very carefully. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment