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.
- 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.
Cygwin is a command line environment providing common Linux tools
Download cygwin from here, install it using default options.
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.)
And make git-ftp script file executale
chmod +x git-ftp
Next copy it to /bin directory so that you can run it from anywhere
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
This will configure your FTP server with specified host address, user name and password.
Running following command to push your staged files tracked by git
git ftp push
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.