No, Git does not support a push to an FTP server, only clone and fetch.
Create a Git Deploy key that allows pushing to your production Git server. Store the Git Deploy key in a secret on Semaphore. Create a deployment pipeline and attach the Git Deploy key secret. Run a deployment from Semaphore and ship your code to production.
Some tools recently added to the Git wiki:
git-ftp by René Moser is a simple shell script for doing FTP the Git way. Use git-ftp.sh to upload only the Git tracked files to a FTP server, which have changed since the last upload. This saves time and bandwith. Even if you play with different branches, git-ftp.sh knows which files are different. No ordinary FTP client can do that.
git-ftp by Edward Z. Yang is a simple script written in python for uploading files in a Git repository via FTP, only transferring new files and removing old files.
If you prefer GUI, use SourceTree, you can easily setup a Custom Action that uses git-ftp mentioned above. A brief description on setup (for Mac) at Push a Git repository to an FTP
I've found PHPloy a great tool for sending your Git commits to remote servers over FTP. It works from the command-line and is written in PHP (and even detects changes in submodules).
https://github.com/banago/PHPloy
git commit ...
phploy -s staging
phploy -s production
Done!
(Disclaimer: after using it for a while I've now contributed some code patches and improvements, making it Windows-compatible.)
If you're on a mac and have Transmit, I'd recommend the following git-tranmit script (https://gist.github.com/379750). It uses DockSend to send only the last updated files. If you're not familiar with DockSend, check out http://www.panic.com/blog/2010/11/15-secrets-of-transmit/.
Setup:
That's not what git is for, strictly speaking. However, if your source is something that doesn't need compiling or processing, say a website consisting entirely of html and javascript files and the like, you could have a clone of the repo on your webserver and use git pull
from the server to keep it up-to-date. Note, I would config your webserver to hide the git directory and such. And that's just the beginning of the security concerns.
If you have any sort of compiling or processing, you should start looking at Ant, Maven, BuildR, SBT, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With