How to use git-ftp on Windows

Background

Before introducing how to use git-ftp on windows, I want to tell some story.

Two years ago, I used Filezilla and ftp to deploy websites. If some files are changed, I have to upload these files manually again. Finding changed files is a time-wasting progress, I have to say. But worse thing is sometimes I forgot which files are changed and I didn’t upload all changed files. Then client saw the website is broken and complained to me. It’s really painful..

Later I heard about git and started learning it. Using git to deploy is a happy progress. I don’t need to find changed files or upload them one by one manually.

But what if some cheap web hosting solutions don’t support ssh or git? Finally I found git-ftp

 

What is git-ftp?

Git-ftp is a deployment tool to deploy your changed files which are tracked by git. It’s useful because some web hosting companies don’t support ssh or git, but only FTP.

But git-ftp is a Linux shell script, so we need to install cygwin to run this script on windows.

 

Requirements

  • Download git-ftp from GitHub
  • Download msysgit from Google Code, and make sure you check “add msysgit path to PATH environment variable” option during installation.
  • Download cygwin from here, install it using default options.

 

After Installation

Then open cygwin from desktop or start menu, go to the directory containing git-ftp script file (the drives are under /cygdrive directory, such as /cygdrive/c, /cygdrive/d, etc.)

cd /cygdrive/d/Downloads/git-ftp-0.8.4.0

And make git-ftp script file executale

chmod +x git-ftp

Next copy it to /bin directory

cp git-ftp /bin

 

Now it’s done, Let’s run it!

Since this is the first time we use it, we need to run “git ftp init” for initial push

git ftp init -u foo -p – ftp://example.com/directoryA

git-ftp

git-ftp windows

After uploading is done, it will remember this version as last deployment, so if you run “git ftp push” later, it will upload changed files compare to this version and set new version as last deployment.