0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks your answer pointed me in the right direction, this site helped a lot: toroid.org/ams/git-website-howto

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.