Welcome to the Linux Foundation Forum!

Version Control for website with ftp only access

Hi,

I am working with some others on a web page and we are looking for a version control system to manage the code (html, css, php, javascript) of the page.

Unfortunately we have only access via ftp to the server (no ssh). So we need something that allows the normal work flow, i.e.:

user A and B fetch the code, and edit it. A pushes the code, B fetches again, merges, pushes and so on...

I had a look on git (which I use for my other projects) but as far as I know it does not allow a push over ftp. I had also a look at git-ftp (http://wiki.github.com/ezyang/git-ftp/) but this seems not to provide merging.

Does anybody knows a way to manage files with a version control system via ftp? It's OK if its not git.

Or do we need a better web hoster with ssh access?

Thanks a lot and best regards,

Michael

Comments

  • jabirali
    jabirali Posts: 157
    After a bit of googling, I found that someone on this page suggested using CurlFtpFS to mount the FTP target locally, and then use Git as you would with any other local repository.

    I have to quote the author of that post on this potential problem though:
    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.
    One workaround I can think of, would be to implement a lock file and make a couple of wrapper scripts around your Git commands. For instance, instead of just using git push to the mountpoint (say /mnt/ftp/) , you could create a script that:
    [ol][li]Tries to remove the file /mnt/ftp/lock. If the action fails (because the file was already removed by someone else), the script aborts.[/li][li]Runs git push to /mnt/ftp/.[/li][li]Recreates the empty file /mnt/ftp/lock (with touch), to again enable access for other users.[/li][/ol]

    Hope this helps :)
  • MichaelK
    MichaelK Posts: 20
    Thanks a lot for this idea.
    I did not know that one can mount ftp targets. I will give it a try and than report back.
    But the missing LOCK feature could be a big problem. We are at the moment two developer, so this could lead into troubles. The wrapper script checking for a lock-file could be a workaround here. I think I will also give this a try.
    The next problem I am coming to see, is that the other developer uses windows. But first I try to figure it out myself and than I try to convert him (or find a similar solution for systems without CurlFtpFS).

    Best regards,

    Michael
  • jabirali
    jabirali Posts: 157
    The next problem I am coming to see, is that the other developer uses windows.
    It should be possible to mount the FTP drive locally in Windows too using something like NetDrive (the website claims it is free for home use).

    I've never tried working with Git on Windows though. You could try Cygwin to use Git from a Linux environment inside his Windows installation, and apparently there is also a native version and various GUIs available too (Git Extensions, TortoiseGit). I'm not sure how you would go about forcing the graphical tools to check for a lock file though, so if you're writing a couple of scripts for your Linux environment anyway, letting him use Git from within Cygwin might be the best choice.

Categories

Upcoming Training