Skip to content
Automatically mirror repositories between Github, Gitlab & Azure DevOps
C# PowerShell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
GitMirrorAutomation.Func
GitMirrorAutomation.Logic
GitMirrorAutomation.Tests
deploy
docs
screenshots
.editorconfig
.gitignore
GitMirrorAutomation.sln
LICENSE
Readme.md
azure-pipelines.yml
global.json

Readme.md

Git mirror automation

Automate the mirroring of git repositories across multiple services (such as github, gitlab & Azure DevOps).

GitMirrorAutomation

Motivation

A long time ago I wrote about mirroring github, gitlab and Azure DevOps repositories.

I still use this workflow (with slight improvements) to mirror repositories but it still required a set of manual steps. I decided to automate them with this azure function.

Manual steps this project solves

While using the automation steps described in my blog post there are still manual steps left after creating a repository in github:

  • Sign into and create the same repository in Gitlab
    • Set the same description as github
  • Sign into and create the same repository in Azure DevOps
  • Create a new mirror build in Azure DevOps (by cloning an existing one and updating the source repository)

How it works

The azure function runs on a schedule and uses configuration files to scan the source for any new repositories.

If new repositories are found the function uses the APIs for Azure DevOps/Gitlab to create the necessary repository/build pipelines.

Once the build pipeline exists it is triggered on every push as well as a schedule to mirror the repository.

(I use Azure DevOps builds instead of github actions because Azure DevOps allows secret sharing across pipelines).

Overview & Supported features

Mirror repositories between Github, Gitlab & Azure DevOps using free Azure Pipelines for mirror automation!

Architecture

The service has 3 major parts, all of them are executed as part of the Azure function once for every configuration file (loaded from storage):

  • (1) Then function scans the source (by default every 5 minutes) for new repositories
  • (2) For every new repository it creates a build that automatically mirrors the repository on any future changes (git push on any branch)
  • (3) And finally it creates the target repositories (with identical names) at the desired target services

See configuration, supported sources, supported mirrors and supported targets for more details on each.

Examples

Examples can be found here.

You can’t perform that action at this time.