Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm not sure this is the right place to ask this question, but here goes.

I have a website on a shared hosting linux server. In an ideal world I would make all changes to it offline in a version controlled environment and then upload these changes when perfected. Although I do this with major changes, this does not happen for small changes and without downloading every file and inputting into VCS before changing and uploading it is not simple to ensure version control of the live files. I dont have SSH access and I dont really want to have to change providers.

I am wondering if there is a web only Version Control solution that will work on a shared web server with no further permissions other than those required to run a php site? I can run perl scripts and thought about using fossil, but it seems you can only run the UI and cant run other commands.

Is there a php VC system? Can I run git commands on a shared hosting platform via a php/perl script?

Basically what I want to be able to do is make changes to my site live and then when finished my changes call a php or perl url and have the changes commited to a version control repository.

PS. I know editing a live site is not a clever thing to do, but I'm still interested in a solution to my problem.

share|improve this question
add comment

closed as off-topic by gnat, Dan Pichelman, MichaelT, Ozz, GlenH7 Oct 2 '13 at 12:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, Dan Pichelman, MichaelT, Ozz, GlenH7
If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers

I have never tried doing this on a live web site, but you can use the Unix utility wget to mirror a web site. You'll probably need to experiment to get the command line switches right, although the -mirror option is suggestive. You might also need to jump through some other hoops if you have files stored outside the web server's document root.

What's that look like?

  • Create a repository using whatever VCS.
  • Download the web site using wget.
  • Commit the downloaded files as a new project to the VCS.
  • Test.
  • Make changes to the live web site.
  • Download only changed files using wget.
  • Commit the changes.
  • Test.

It's a little backward from what I'm used to, and the risks are obvious, but if that's what you want to do, wget might take you a long way down the road.

share|improve this answer
    
+1, fixing the workflow and using the right tool is the correct call here. –  Wyatt Barnett May 8 '11 at 19:22
    
Ummm ... if the OP's site is PHP scripts then wget will get the output produced by PHP, not the actual PHP, and there's probably not much point versioning that. –  James May 8 '11 at 23:45
    
wget supports ftp. –  Mike Sherrill 'Cat Recall' May 9 '11 at 0:03
add comment

Have you checked these out? I think they are mostly for viewing rather than committing, but some might be able to do both.

share|improve this answer
add comment

We have a duplicate setup site behind the firewall that is copied to the live location using a shell script that is run on a schedule. The backup code is updated and then copied to the live site using a cron job. The backup is fully operational and at the same time is keyed through source control.

share|improve this answer
add comment

So many good code editors allow you to have a local dev or test environment and then synch to a live server using FTP. They only upload the files you change, and they give good visual indicators of the differences between the test and the live sites.

With virtual machines and the ability to reproduce your dev environment locally, there's really no real reason to have to develop on the live site anymore.

share|improve this answer
    
Thanks Amy, but I'm afraid that doesnt answer my question, and I believe you are correct, but it doesnt work for me. –  Toby Allen May 18 '11 at 14:17
add comment

I maintain several websites using git. I work in branches to make changes and merge those into master when they are ready. I push changes to the live host, where a special branch "live" is checked out. I merge changes into live when I want them.

If something's messed up, I go back to the last "live" SHA that's good.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.