ericbowden
ericbowden

Reputation: 2205

Setup up website and beta site using git

I have a website that I am setting up that I want to use git for version control. My idea is to create a beta subdomain where I can test the site and then 'push' it to the main site in the public_html folder. Everything needs to be on the server to access the database. I tried to actually clone the main site into the beta folder but I receive the following error when trying to push to the main site.

remote: error: By default, updating the current branch in a non-bare repository denied

I tried to use a bare repo but that is no good for a website as it does not contain a working tree.

Is there a better way to do this?

Upvotes: 0

Views: 86

Answers (1)

Benoit Courtine
Benoit Courtine

Reputation: 7064

I think you can use the "git post-receive hook".

On server, you have to use two repositories:

  • the bare repository (where you will upload the code by "git push")
  • a clone of this bare repository. This clone will host your website

On the bare repository, you configure the post-receive-hook: when the repository is updated, you can automatically perform an update of the clone repository to update your website.

Upvotes: 1

Related Questions