I have a Drupal install on a shared server and would like to do some version control on it, namely git.

I'm a beginner at Drupal and only just starting with git so I've become a bit overwhelmed with any instructions on the web for doing this, as they assume you're proficient with one or the other.

What I want my setup to be is

  • The hosted Drupal install is my git's "local" repo.
  • Make changes, commit
  • Push to github

The problem is that as it is a shared server, I don't think I can install git. So, firstly, is this workflow possible without installing git on the server? And, if so, secondly, could somebody please point me in the right direction for setting this up.

As always, if somebody has a better way of doing it, please say!

  • i don't know if you have a shell for communication with git on your shared hosting webspace. I have a virtual server with root right. THere you can log in via ssl (putty on windows) and write git commands, make the directory a git controlled etc. from this directory you can push and pull like you want...i use github for the central place to work with my code...
    – Jurudocs
    Commented Sep 14, 2012 at 7:55
  • 2
    First things first, contact your hosting provider and make sure you can install git (or at least get them to install it). If not, the rest of the questions become moot, there's no way to have a git workflow without git installed on the server
    – Clive
    Commented Sep 14, 2012 at 7:55
  • +1 for using the word "moot". Okay, I shall email the host and see. Fingers crossed. If I can get git installed then is there a better workflow I should be using?
    – dav_i
    Commented Sep 14, 2012 at 8:43

1 Answer 1


Fair warning, I don't know Drupal, so it's possible you're describing a common workflow. All the same I know a thing or two about git, and what you describe is a bit backwards. The problem is here:

  • The hosted Drupal install is my git's "local" repo.
  • Make changes, commit
  • Push to github

By treating your production environment, the hosted Drupal install, as your local repository, you basically circumvent the benefits of versioned deployment. If you break that local, you break the site. If you want to work on a test feature branch (maybe new content you're still creating), you have to expose it to the world. A more canonical approach might be:

  • Commit to the site locally (on your computer) as well as a clone on your hosted site. Use github to push and pull between them. The Drupal docs have a solid example of this.

  • Commit to the site locally (on your computer), and use a post-receive hook to deploy the Drupal site, if your hosting provider supports git installation. This is a common setup in web application deployment.

In either case, note that you want a truly local copy, some place to experiment around, rather than the live website.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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