Skip to main content

Deploy your Git code by FTP to a remote server

Jose CerrejonLess than 1 minuteDeveloperDeveloper

Deploy your Git code by FTP to a remote server

git-ftp
git-ftp

Not always will be lords and masters of a VPS with SSH connection to upload into production our projects. Sometimes we'll find servers where the only option for upload your code will be using the FTP protocol, which is a bummer when one or more do deploys in a day. If you work with Git, I'll teach you my method to upload the commits to a ftp server without changing the technology.


ftp
ftp

[ Installation and setup ]

The instructions are pretty clear for all platforms as you can see hereopen in new window. I use brewopen in new window with OSX:

brew install curl --with-ssl --with-libssh2
brew install git-ftp

Go to your project folder and execute the following using your credentials:

git config git-ftp.url ftp.example.net
git config git-ftp.user ftp-user
git config git-ftp.password "secr3t"

Now upload all files with git ftp init or if the files is already on the server: git ftp catchup

[ Use ]

Not much mystery. Use git to commit your repo as you do normally, but when you want to upload the changes to ftp, use the command git ftp push. An example:

echo "new content" >> index.txt
git commit -am "Add new content"
git push remote master # commit to our server
git ftp push # upload changes to ftp

Link: github.com > git-ftpopen in new window