About IT and Sports

My Web development experiences and sports encounters


Posts Tagged ‘git’

Git deployment over ftp

Most shared hosting services don’t offer git deployment options. Normally you just use ftp to upload your changes to your website. It’s easy to make errors on such deployments, especially when you do updates where you only want to change a number of files. Because I didn’t want this anymore for my blog, I looked for a better solution.

I found git-deploy. It’s a binary executable which you run from your Linux development environment. It’s able to deploy only the changes since your last deployment. It requires ruby and can be installed using gem. I followed the installation instructions on the project homepage on github: https://github.com/aizatto/git-deploy.

The only thing I was missing in this installation description was the installation of ruby. I used this command:

sudo apt-get install ruby libruby rdoc libgtk2-ruby libglade2-ruby libyaml-ruby libzlib-ruby libopenssl-ruby libdl-ruby libreadline-ruby libiconv-ruby sqlite3 libsqlite3-ruby irb libssl-dev

Copy the git-deploy binary to your binaries path. Create a deploy.yml and REVISION file. The REVISION file is used to save the commit-id of the last deployment.

When you committed changes to git, just run git-deploy. The REVISION file on your ftp site is updated by git-deploy.