Mirror repositories on web development server

124 views Asked by At

As I read on git documentation bare repositories are good for sharing and non-bare repositories are good for developing.
I'm setting up a development server which should provide SCM, Jenkins, and serve webpages to do some manual testing.
To provide SCM I use GOGS which creates bare repos to share between developers, I need that these bare repos somehow get hardlinked to non-bare repos on the apache folder (usually /var/www/http/) and mimic all the changes on the bare repo automatically.

Is it possible?

2

There are 2 answers

0
VonC On BEST ANSWER

provide SCM I use GOGS which creates bare repos to share between developers, I need that these bare repos somehow get hardlinked to non-bare repos on the Apache folder (usually /var/www/http/)

That is generally done by a post-receive hook set in your bare repo managed by GOGS.
That script would be:

git --git-dir=/path/to/project_root/.git --work-tree=/var/www/http/ checkout -f

Any commit pushed to those bare repo will be visible in your web site.

0
Edwin Buck On

To make a non-bare repo, git clone the bare repo into the desired location.

As an aside, I would not recommend developing in the same location that is used for deployment. It eventually constrains you in really undesirable ways. Instead, build a small script that makes your "deployment bundle", a tgz or zip file that contains the items that need to be unpacked in your web server.