I'm having a website with many big images file. The source (as well as the images) is maintained with git. I wish to deploy that via ftp to a bluehost-like cheap server.
I do not wish to deploy all the website each time (so that I won't have to upload too many unchanged files over and over), but to do roughly the following:
It is similar in spirit to svn2web. But I want that for DVCS. Mercurial alternative will be considered.
It's a pretty simple script to write, but I'd rather not to reinvent the wheel if there's some similar script on the web.
Capistrano and fab seems to know only how to push the whole revision, in their SCM integration. So I don't think I can currently use them.
If you use Git and you need to upload your files to an FTP server, Git-ftp can save you some time and bandwidth by uploading only those files that changed since the last upload. It keeps track of the uploaded files by storing the commit id in a log file on the server.
The git-ftp script might be what you are looking for. It takes the changes local git repository and syncs it to a remote git repo over ftp.
I used it by hosting a git repo created using the --bare option. Put it on my ftp server.
than ran ./git-ftp.py. It prompts for ftp username, password, ftp host, local git repo path, remote git repo path (the location of the bare repository).
Then it connects to the ftp git repo and then sends the diffs alone. (it uses the git-python library to get that info needed).
The script has few issues. It seems to be prompting for username details always and I had to comment out line 68.
#ftp.voidcmd('SITE CHMOD 755 ' + node.name).
But those things can be easily fixed.
Alternative
If you are on a nix platform an alternative is to use curlftpfs. It will mount your ftp account as a device directory from which you can do all normal git operations (push, pull). Of course this solution ain't git specific.
You need to use the bare option as mentioned above on the repo shared on FTP as well as run git update-server-info within the repo before sharing it over FTP.
Caution: This isn't a good idea if you plan to have multiple users to write to your git repo. As FTP has no mechanism to LOCK access. You will end up with a corrupt repo. Test before taking to production.
I've created a script called git-deploy, hope it helps.
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