So I recently had to setup Git on our Joyent Solaris box and host some repositories that would enable us to do remote pushes to our server.
So I thought I would share my experience in the hope to save people some time.
Here we go:
At the time of writing Git was 1.5.5.4, update the download url and git directories as need be to suit your git version.
1.) Get the git and decompress...
wget http://kernel.org/pub/software/scm/git/git-1.5.5.4.tar.gz
gtar xvfz git-1.5.5.4.tar.gz
cd git-1.5.5.4
2.) Configure, make and install...
./configure --prefix=/opt/local
sudo gmake AR=gar NO_ICONV=1 NO_TCLTK=1 CFLAGS="-Wall -O2 \
-I/opt/csw/include" LDFLAGS="-L/opt/csw/lib"
sudo gmake install AR=gar NO_ICONV=1 NO_TCLTK=1 CFLAGS="-Wall -O2 \
-I/opt/csw/include" LDFLAGS="-L/opt/csw/lib"
3.) Changing hook scripts...
On Solaris, it seems that /bin/sh is a Bourne Shell which will fail in error when executing some of git's hook scripts. So we need to update these hooks scripts to use /bin/bash
cd /opt/local/share/git-core/templates
perl -e "s/\/bin\/sh/\/bin\/bash/g;" -pi $(find hooks -type f)
4.) Update $PATH...
For any users who intend using ssh to access the git repositories they will have to add '/opt/local/bin' to their path. You can do so by editing your '.bashrc' and amending the path.
5.) Create the repositories, replace values as need be. This will have created a bare repository that is ready to be pushed to.
mkdir /repos/my_repos.git
cd /repos/my_repos.git
git --bare init
6.) Push to your repos...
git remote add origin ssh://your_user@your_joyent_server/repos/my_repos.git
git push origin master
Notes:
- The /bin/sh problem may not occur, it depends on what distro your are using.
- Make sure your Git ssh user accounts have the relevant access to the above created directories.