I’ve never been a user of Git, but lately I’ve been really interested in how I can improve my work flow. I’d been told by several people that Git is fantastic and I should give it a shot, but I just never got around to trying it out.
This week I decided that would change. I spoke with Jason Kinney, who used to work at Weblinx with me, and he explained many of the great things about Git to me. While many features are great for people who collaborate, I work on most of my projects alone, so the thing that really caught my attention was version control.
Using Git, you can have backups of every version of your site. You can revert back to any stage in the development cycle, merge back certain files, create separate branches for development vs production, and much more.
So off I went, trying to get started with Git. I looked in to hosting my projects on GitHub, but unfortunately I couldn’t use that for most of my projects with Weblinx because they’re closed source.
I did some digging, and I found a great looking system called GitLab. I had an old netbook laying around, so I installed Ubuntu Server 12.04 LTS on it, and got to work. GitLab offers great “Omnibus” packages that make it super easy to install on several OS’s. Sadly, because I had to use an x86 chip, I couldn’t use their pre-built packages. Instead, I followed the instructions provided for installing from source.
Strangely, when I first tried setting everything up, I kept getting errors when trying to use apt-get to install anything. I did some Googling and finally ended up posting a question on the Ask Ubuntu site. After several hours of fighting with the command line (it’s like an alien language to me), and with the help of a user on Ask Ubuntu, I was able to fix the issue.
It turns out I was having a “hash mismatch” issue. I was able to run some commands to clear this up:
sudo rm /var/lib/apt/lists/*
sudo apt-get update
So on I went, having no more problems plugging in commands until I hit Step 5, Redis. Every time I would try to run
echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf, and then
sudo service redis-server restart, I would get an error saying something about “too many parameters.” After a few more hours of Googling, I discovered that the version of Redis that comes bundled with Ubuntu Server 12.04 LTS doesn’t support
unixsocketperm. So I just skipped that step and everything worked fine.
I continued down the list, and everything else went fine. Or so I thought. The next day when I tried to connect, I realized something was amiss. I couldn’t push/pull/etc with git, so I did some more research. It turns out I had forgotten to set the gitsite_url. I set it to the domain I set up, http://git.ghsotlyco.de/, and it started working fine.
The only issue remaining is that notification emails aren’t sending out. I’m not too worried about that for my uses, but it is one little thing that’s not working.
Overall, this project went really well and I think it’s going to turn out to be a great investment. I can now privately manage my projects using git, without having to pay for private repos.
My next project is figuring out how to create automatic off-site backups of the server. I’ll report back when I get that up-and-running.