Need some help with source code version control



I need to find a way to do version control between two remote locations. For example, sometimes I have a client who uses another host, but I setup a dev site on DH for testing. Right now I copy the changes manually, but would much rather have it done via version control.

It is very important to me that the dev site not be local. Then I’d have to configure PHP, MySQL… on every computer I edit on. Plus I’d have to setup DNS, which wouldn’t work with multiple local boxes needing the dev site to have the same DNS info.

It seems like neither SVN nor Git will allow for both the repository/live site and the working/dev site to be at remote locations. I’ve got SVN setup on DH and it’s working, but it still forces me to have a local copy and it wont push anything to another host.

Any suggestions on how to do this?



Source code management tools are just that — source code management. They aren’t deployment management tools. For that, what you probably want is something like Capistrano.

(Disclaimer: I’ve never used Capistrano, I’ve just heard people talk about it. Your mileage may vary. Void where prohibited. Remove baby before folding.)


Ah, it’s for Rails… my stuff is all PHP.

You bring up an interesting possible flaw in what I think I’m looking for. My end goal is to have two sites - one dev and one live - and to have some sort of more automated and thorough method for pushing changes live.


Capistrano is written in Ruby, and it was originally developed for deploying Rails sites, but it’s not by any means limited to that. It’ll work just fine for deploying PHP sites as well.


I am still trying to fully grasp how it works. It seems like I’d still need to use SVN or Git.

Let me explain a bit more about what I am trying to do.

Let’s say I’ve got three sites:

  1. DH user1 dev - HostA user1 live
  2. DH user2 dev - HostB user1 live
  3. DH user1 dev - DH user1 live

Currently I use a FTP app that lets me browse files on the server, then click edit and it does the downloading and uploading behind the scenes. So I am effectively editing off of the server. When I hit save, it automatically saves on the server.

When I want to move stuff to the live server, I have to do it manually via FTP (or SSH or SFTP…)

I don’t want to have to setup a different SVN, Git… server for each site. I’d rather have one centralized thing that I can enter in the locations of the dev and live sites.

Then when I’m done on the dev site, I can push a button, review changes and push the changes live.

I currently have about 70 sites on DH. So you get the idea why I don’t want to setup a SVN instance for each one.



Yes, you will still need SVN or Git. Capistrano is not a substitute for source code control — it’s just a set of tools for deploying code from version control to servers.


I’ve used version control tools for years to handle simple deployments, dating back to the old svn (not so well suited because of branch limitations), CVS (better suited because branches work better, but maybe I was just more familiar).

Better to use a distributed version contriol like git or mercurial (or bazaar).

Although I have more experience with git, I tend to use mercurial (hg) more and more, mainly because hg works okay on windows, which allows me to work in cygwin on my windows tablet, and then push to my websites.

Yes, a deployment system is better. But a VC tool is a good start.

Biggest problem - with git, maybe also with hg, not sure yet - is that it version controls file contents but not permissions. (CVS made some attempts to maintain file permissions.) You’ll need other scripts to maintain the correct permissions on directories, etc.


Oh, wow. That seems like a show stopper right there. For example, I want to use this with modified versions of WordPress. If it’s not going to keep my file permissions, I’m going to be in trouble.


It’s not as big of a deal as you’d think, as file permissions don’t really matter on most files in a web directory. The only file I can think of in a WP install that you’d want to alter permissions on would be the main config file, and that one probably shouldn’t be in version control anyway (as it needs to have different contents for different environments anyway).


But it would matter for the core files, plugins… right? I’ve got some modifications I’ve made to the WP core files that I want to keep intact.