Skip to content

miracle2k/gitolite-simple-mirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Gitolite has very advanced mirroring features, but they can be tedious to use if you are just looking to mirror push some repositories to Github (*).

Here is an alternative post-receive hook that doesn't bother with master/slave declarations, and just lets you define one or more target repositories to which to mirror like so:

repo    foo-project
        RW+     =   me
        config gitolite.mirror.simple   =   "git@github.com:miracle2k/foo-project.git"

repo    bar-project
        RW+     =   me
        config gitolite.mirror.simple   =   "git@github.com:miracle2k/bar-project.git git@bitbucket.org:miracle2k/bar-project.git"

It's also possible to mirror multiple repositories in one go:

repo    @public-projects
        config gitolite.mirror.simple   =   "git@github.com:miracle2k/REPO.git"

As you can see, REPO will be replaced by the repository name. This is done within the hook.

Finally, you have the ability to add custom options to the mirror push. In this example, using --no-force allows you to use the Github web editing features without fear of accidentally overwriting such changes::

repo    @public-projects
        config gitolite.mirror.simple             =   "git@github.com:miracle2k/REPO.git"
        config gitolite.mirror.simple.extra-args  =   "--no-force"

Setup (gitolite v3)

To make the above configurations work, you need to do the following:

  1. Edit ~/.gitolite.rc to allow the config keys, for example like so:

     GIT_CONFIG_KEYS => "gitolite\.mirror\..*"
    
  2. Setup public SSH authentication from your Gitolite server to the mirror target. Don't forget to connect at least once to pass SSH host key verification.

  3. Copy the post-receive hook from this repository to ~/.gitolite/hooks/common, or, preferably, to your own directory that you have setup via LOCAL_CODE. see the Gitolite docs for more. Make sure the file is executable.

  4. Run gitolite setup (as the user serving gitolite) once to have the hook installed in all repositories.

Setup (gitolite v2)

To make the above configurations work, you need to do the following:

  1. Edit ~/.gitolite.rc to allow the config keys, for example like so:

     $GL_GITCONFIG_KEYS = "gitolite\.mirror\..*";
    

    See the Gitolite docs for more on the setting.

  2. Setup public SSH authentication from your Gitolite server to the mirror target. Don't forget to connect at least once to pass SSH host key verification.

  3. Copy the post-receive hook from this repository to ~/.gitolite/hooks/common, see the Gitolite docs for more. Make sure the file is executable.

  4. Run gl-setup (as the user serving gitolite) once to have the hook installed in all repositories.

(*) Or even impossible if the push target does not support the "host:repo" syntax of gitolite; gitolite's mirroring support is primarily intended to mirror between multiple gitolite instances.

About

post-receive hook to do make mirroring with gitolite easy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages