Search code examples
gitjenkinsservergogs

Mirror repositories on web development server


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?


Solution

  • 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.