Git-aware FTP/SFTP deployment
Bring the intelligence of Git diffing to FTP/SFTP deployments — only ship the files that changed.
A vital part of any web project is the final step: pushing your code and assets onto a live server. Not only that, but you also need an easy way to deploy subsequent bug fixes and feature updates. This can become time-consuming, especially if you're limited to FTP or SFTP access on your deployment server. Keeping track of which files changed locally versus remotely can quickly turn into a headache. We've all been there, right?
Some things to consider for deployment:
This guide focuses on a solution for situations where:
git-ftp is a clever script that acts as an FTP/SFTP client specifically designed for Git repositories. It intelligently transfers only the files that have changed since your last deployment, leaving untouched files alone unless explicitly told otherwise.
It's typically run as a shell script from your local command line.
If your deployment server is on shared hosting or an otherwise locked-down system, you might not have shell (SSH)
access. This means you can't use standard Git commands (git pull, git push) directly on the
server to deploy. In such cases, FTP or SFTP is often your only way to upload files. git-ftp bridges
this gap.
Installation & Configuration: You can find installation instructions on the
official git-ftp GitHub page. Once installed (e.g., within Git Bash
on Windows, or natively on Linux/macOS), you configure your deployment settings directly within your project's
.git/config file. This keeps deployment settings version-controlled along with your project.
Very handy!
Configuration examples (see the man page for full details):
# Set username, server address, and password (use secure methods like keys instead of password!)
git config git-ftp.user your-ftp-username
git config git-ftp.url ftp.yourserver.com/path/to/public_html
git config git-ftp.password 'YourFtpPassword' # Avoid storing passwords here if possible!
# For SFTP (recommended over FTP)
# git config git-ftp.url sftp://sftp.yourserver.com/path/to/public_html
# Consider using SSH keys for passwordless authentication with SFTP.
Initial Deployment (init): The first time you deploy to a server, you run:
git ftp init -v
This uploads all files from your current Git branch to the remote server. The -v (verbose) flag
provides feedback, which is useful for large uploads. Crucially, git-ftp also uploads a special log file
(usually .git-ftp.log) to the server. This file stores the SHA hash (commit ID) of the commit you just
deployed.
Subsequent Deployments (push): After making changes, committing them locally in Git,
you deploy updates using:
git ftp push -v
git-ftp now does the following:
.git-ftp.log file on the server.Example Workflow:
file1.txt, file2.php, file3.jpggit ftp init -v -> Uploads all 3 files + .git-ftp.logfile2.php, delete file3.jpg, commit
changes.git ftp push -v -> Uploads the new file2.php, deletes
file3.jpg on the server. file1.txt is untouched..git-ftp-ignore / .git-ftp-include: Specify files or patterns to
explicitly exclude (like local config files) or include (if not tracked by Git) during transfers.staging,
production) within the same .git/config, allowing you to push to different servers easily
(git ftp push -s staging).git-ftp. Editing files directly on the server will put it out of sync with the log file and cause issues
on the next push.git ftp push. This encourages good Git practice (commit often!) but might feel slightly cumbersome if
you're used to testing frequently via direct FTP uploads without committing.
Despite the limitations, I find git-ftp incredibly useful, especially for projects hosted on servers
with only FTP/SFTP access, or for simpler file-based sites (like those built with static site generators or
file-based CMSs like Statamic, Grav, or Kirby). It brings the intelligence of Git diffing to the world of FTP
deployment, saving significant time and reducing errors compared to manual uploads. For my purposes, it often
provides everything I need.
If you're stuck with FTP/SFTP but use Git locally, give git-ftp a try – it might significantly
streamline your deployment process. Feel free to get in touch if you have questions about setting it up for your
project.
2026 update git-ftp is still maintained and still the right tool when FTP/SFTP is
genuinely all you've got. If your host gives you more, the modern alternatives are worth knowing: a
GitHub Actions (or GitLab CI) workflow that deploys on push — including via SamKirkland's
FTP-Deploy action if you're still FTP-bound — rsync over SSH for a fast,
diff-based transfer, or Deployer for zero-downtime,
atomic-release PHP deployments with easy rollback. The core idea here — only ship what changed, keep deployment
under version control — is exactly what those tools automate.
I help content-rich organisations understand their data and pull it back into one place. Tell me what specific problems you're having and I'll be happy to talk solutions with you.
Tell me what specific problems you’re having and I’ll be happy to talk solutions with you.