Lime Blast (The virtual home of Web developer Daniel Hollands, the place to be if you're looking for articles and tutorials (and rants) on all aspects of the World Wide Web.)
  • Navigation
  • Home
  • About
  • Portfolio
  • Blog

Deploying a Git repository via FTP

Posted: 13th April 2012 at 12:14 pm

Comments: 6 Comments

Contents

  1. git-ftp to the rescue
  2. Alternatives
  3. Conclusion

As any regular reader of this blog will know…

*watches as tumble-weed bounces across the void*

…one of the main reasons I got a dedicated server was because of Git, and all the wonderful things that it is able to do for you.

The problem I quickly discovered was that all of my (and my employer’s) customers used shared hosting, which meant being limited to FTP for uploading changes to their websites.

This meant that when it came to deploying my changes to the server, I still had to find and upload each of the changed files manually (or think “sod it” and upload them all, to make sure I didn’t miss any).

And, if I’m honest, this became quite repetitive and boring… So what should you do if you want to automatically deploy from Git via FTP?

git-ftp to the rescue

git-ftp is a free and open source Bash script that allows you to push files in a Git repository via FTP to a remote server. But rather than upload all the files each time you push, git-ftp is intelligent enough to only upload (or delete) files that have changed since the last push.

It also has additional features such as configuration of an ignore file, which will prevent any specified files from uploading, and the ability to perform dry-runs, which simulates the upload facility, to make sure that nothing will go wrong before you do push for real.

Installing git-ftp was so simple that even I (a Neanderthal when it comes to most things Linux) was able to do it without issue, and once a repository is configured with the correct FTP settings:

1
2
3
$ git config git-ftp.user daniel
$ git config git-ftp.url ftp.example.com
$ git config git-ftp.password s3xyAnd1Kn0wIt

and an initial git-ftp initiation process is completed, pushing the most recent changes is a simple as:

1
$ git ftp push

Alternatives

To help avoid confusion, I figured it would be important to point out that there is another project hosted on github which has the same name, and does the same thing, as the aforementioned git-ftp, but is written in Python rather than Bash. As I’ve not used it, I cannot comment on it, but if Python is your thing, then you might be interested in trying that instead.

Alternatively, if you don’t mind spending a bit of money, it might be worth taking a look at Beanstalk. This is designed to be an all-in-one solution alternative to github for repository hosting, with the additional benefit of automatic FTP deployment, and third-party service integration, etc…. I gave their free plan a try, and the service they offer seems to work well…

Conclusion

…but personally, seeing as a price-tag of free is very attractive, I’m quite happy combining git-ftp and Bitbucket (more on this in a future post), and in fact do so for 12 (and counting) projects.

Written by Daniel Hollands

Daniel Hollands is a jack-of-all-trades web developer trying his best to keep up to date with everything the Web has to offer. He keeps this blog in the hope that someone might find what he has to say useful.

Visit his Homepage, follow him on Twitter, Facebook, LinkedIn, and Google+, or hire him for your next project.

This entry was posted in Credit where credit is due and tagged Bash, Beanstalk, Bitbucket, Dedicated Server, FTP, Git, git-ftp. Bookmark the permalink.

Related posts:

  1. I love you Jose Diaz-Gonzalez

    This is a very quick post to thank Jose Diaz-Gonzalez for the Upload behaviour he wrote for CakePHP. I needed a way of uploading multiple images in the admin area of the Chameleon Photography site. During my Cake 1.3 days,......

  2. Running a server is hard work

    I was hoping, when I first had the idea for this post, that it would be a run-through of all the steps I has taken in setting up my dedicated server. It was going to include links to the resources......

  3. Facebook Timeline Photoshop Template

    Seeing as Facebook’s Timeline feature is making the move to Pages, I figured that now was a good time to share the Facebook Timeline Hack Template that I used to style up my Timeline Page. The download includes a Photoshop......

  4. CSS Crush

    Although there is a lot of love for CSS preprocessors such as LESS and SASS, both of which seem to work very well, I wanted to take a moment to talk about a slightly different alternative, the PHP-based CSS Crush. Much......

Calendar

April 2012
M T W T F S S
« Mar   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Categories

  • Credit where credit is due (8)
  • Gaming (1)
  • Just Plain AWESOME!!! (4)
  • News (6)
  • Personal (3)
  • Rants (4)
  • Reviews (1)
  • Share the knowledge (6)
  • Tools and Resources (3)

Archives

  • June 2014 (1)
  • February 2014 (1)
  • January 2014 (1)
  • December 2013 (1)
  • July 2013 (1)
  • June 2013 (2)
  • May 2013 (2)
  • January 2013 (5)
  • December 2012 (2)
  • November 2012 (2)
  • October 2012 (1)
  • July 2012 (2)
  • June 2012 (3)
  • May 2012 (1)
  • April 2012 (2)
  • March 2012 (4)
  • February 2012 (4)
  • January 2012 (1)

Affiliates

UK Cloud Hosting. Fast, Reliable & Infitely Scalable. TSOHost. eCommerce for Designers - LemonStand FreeAgent Small Business Online Accounting

Recent Posts

  • Reset The Net
  • My Thoughts on Shadowrun Returns
  • Laravel Application Development Cookbook
  • It’s simple, we kill the Batman!
  • Useful Composer packages for use with Laravel 4
  • Goodbye Ghost, Hello School Stickers (I start my new job in July)
  • All Around the Wrekin (Photolog)
  • The importance of a good password
  • Once you go Mac, you’ll never go back – but should I?

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3 other subscribers

RSS

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Tag Cloud

Android Apple Asus Beanstalk Behaviours Bitbucket CakePHP Composer cPanel CSS Debian Dedicated Server Dell EXIM Ghost Design Git GitHub Google Apps Hetzner Inspiron Duo iOS iPad iPhone iTunes Jeffrey Way Laravel limeBase Mercurial Microsoft PC Photoshop PHP Plugins Propeller Communications Responsive Web Design SASS Siri SPAM Submodules Tegra 3 Quad-core Transformer Prime Windows 7 Windows 8 Wordpress Yii
© 2013 Daniel Hollands.