Tag Archives: Git

Using Git to display your web app’s version

I’m mainly writing this down for my own benefit, but others might find this useful. In a previous post about setting up git to deploy to a remote web server, I wrote about a way to display the lastest abbreviated commit hash in your web app’s footer.

Today, I discovered that simply running:

git describe

will output the most recent tag and the current abbreviated commit hash (if there are commits after the tag), so you can use tags to show more human-readable versions of your app (v1.0, etc.) along with the current commit. Unfortunately, you apparently can’t run ‘git describe’ on a bare git repository like what I’m using for deployment on the remote server.

Continue reading

Hostgator and Git

I previously posted about using git to deploy to Ubuntu. However, that’s only relevant to me for my  ”day job” where I can have some control over my server environment. For other work, I currently host a number of sites on Hostgator. I’ve fallen in love with the simplicity and power of deploying sites using Git (after the initial setup), so using Git in a shared hosting environment would be a huge win.

Luckily, I found a few resources out there on how to set this up, but in the end, the only real difference between my workflow for Ubuntu and hostgators turns out to be saving the Hosgator SSH port (2222) in a ~/.ssh/config file as described here.


  1. You must have SSH access on the domain you are working with. I believe it comes with your primary domain, and you have to pay $2(?) a month for SSH access per domain beyond that.
  2. It’s easier if you use the SSH public keys as described here.
  3. You can just create your bare Git repositories under /home/[username]/git if you want to set it up as I described in my previous post.

A Simple Git Deployment setup on Ubuntu Server

After spending a lot of time on trial & error to set up a simple Git web application deployment setup using Ubuntu server, I’m writing this down as a reference for myself and thought it might helpful to others as well. If anyone actually reads this and can comment on:

  • Things I missed
  • Things I did that were stupid
  • Things that were especially stupid

…it will be appreciated.

This is based on Ubuntu 12.04 server and deploying from OS X, though that part shouldn’t matter.

Continue reading