Web Development

git push vs. FTP

November 25, 2016

Building a website is great, but a website doesn’t do any good if no one can see it! Without deployments, you’ll be able to see your website, but no one else will.

In order to be useful, every code change must be deployed, usually to multiple servers, as part of the development and release process.

One common way to deploy code changes is via FTP. Using FTP (or SFTP) for deployment has additional time, cost, and risk that we would rather avoid, especially when there’s a much better option readily available: deploying via git push.

Sometimes we’re asked why we go through additional work to set up deployments with git. Here are 8 reasons why:

  1. With FTP deployments, you need to re-upload the entire website with each change (or manually track which files have changed) whereas git will automatically transfer the exact changes needed.
  2. Git allows us to work with complete changesets rather than individual files. Oftentimes a change in one file will depend on a change in another file. With git, these changes are all bundled together in a commit, whereas with FTP we’re forced to always work with individual files and directories.
  3. With FTP deployments, you can’t tell which version of the code is currently running on the server, whereas git keeps track of that and makes it easily accessible.
  4. With git running on the server it’s very easy to see files which may have been modified or added by malicious code or hackers; with FTP there is no such visibility.
  5. Git uses ssh as the network protocol which allows for individual password-less keys to be used for authentication, instead of shared passwords.
  6. FTP deployments are much more difficult to automate or integrate into a larger deployment workflow which should include things like CSS compilation, JavaScript minification, deleting private files, and more.
  7. Git provides a number of hooks which can run during and after updates are applied, allowing you to run custom scripts automatically when deployments are made.
  8. Git also makes it very easy to roll back to a previous version of the code – should that ever be necessary – since all past versions are already stored on the server.

For these reasons and more, we prefer using git for our deployments.

How do you deploy your code? Leave a comment or a question!

Unless otherwise specified, source code in this post is licensed under a
Creative Commons Attribution 4.0 International license (CC BY 4.0).

You might also like...

14

Dec.

3 Ways to Automate the Detection of Website Vulnerabilities

There is no such thing as perfect security, only varying levels of insecurity. -Salman Rushdie Although the context of this quote is completely irrelevant to the internet and web development, the content of the quote is perfectly applicable to web security. However, if you manage, develop, or run a website, and you value the security … Continued

2

Sep.

Dev Principle #6: Plan Out Your Tech Stack

Architecting an application and deciding on the key components of the technology stack that go into building it is an important task. If software hadn’t worked out as a career, my backup was construction. There are many similarities – from crafting the blueprints to laying the foundation, from choosing your materials to building the structure … Continued

18

Aug.

Dev Principle #5: Do Deployments Right

One of the vital parts of any software project is the deployment process. It’s a central part of starting and growing the living project. Without the deployment process, your project would never see the live state it is destined for. Whether you’re working on a simple personal project or a very active large website, the … Continued