Hello all. I needed to setup a Git server for my team and didn’t want to commit to a paid GitHub account yet. So, I set out to setup a Git server of my own. Instructions are sketchy at best. But, I think I got it to work.
I am using CentOS 5.0 i386.
First, we need to configure Yum to use the RedHat extended Linux repository. For i386 system, run this command:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/ rpmforge-release-0.3.6-1.el5.rf.i386.rpm
If you are using a 64bit OS, run this instead:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/ rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Then, install Git by running these commands.
yum -y install git yum -y install git-daemon
Now, we are all set to start the server. First, create a folder that will be the root of all repositories. Let’s say /root/git.
Start Git daemon as follows:
git daemon --reuseaddr --base-path=/root/git --export-all --verbose --enable=receive-pack &
That’s it. If you are running a firewall, drill a hole in port 9418.
Let’s quickly test things out.
We will first create a repository in the server. Recall, we used /root/git as the root of all repositories in the server. So go there and create a folder for a repository.
cd /root/git mkdir ProjectA cd ProjectA git init --bare
OK, now we have a bare repository on the server called “ProjectA”.
Now, go to a client machine. Run these commands to push to the remote repository ProjectA.
mkdir ProjectA git init touch README.txt git add . git commit -m "Project creation" git push git://SERVER_IP_OR_HOSTNAME/ProjectA master
This should work and get you in business.