Example of an automated synchronization of Git remote repositories by Convention over Git.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
repo_settings
.gitignore
README.md
changed_refs.awk
changes_detector.sh
deletion.sh
fetching.sh
repo_create.sh
run.sh
sample_init.sh
set_env.sh

README.md

Pure Git with Convention over Git

Automated synchronization of remote Git repositories by pure Git and Convention-over-Git.

It is proven and tested solution.

Consider to use git-sinc, the next generation of the remote Git repositories synchronization solution.

This approach uses well-known Git tools. It is because Git has an innate ability to do this. All we need to add is some convention.

How to use

In a terminal (console) navigate to the project's root folder and run the script

bash run.sh

Windows users have to use Git Bash that comes with any Git installation.

In sample_repos folder, you will find prepared (emulated) local and remote repositories with some commits and branches. Commit somthing or do a merge in any "local repository" and do the Git push. Then run

bash run.sh

again to see changes migrated between remote repositories.

Use in Production

Go to repo_settings folder and create there a file with your syncing repositories' settings.
Use sample_repo.sh file as an example.

Then run

bash run.sh your_file_for_repo_settings.sh

Repeat this run when you want to synchronize your remote repositories.

What is this all about!

Convention over Git is a straightforward approach for an automatic synchronization between Git remote repositories. Absolutely separate remote repositories will begin behave as a single remote repository.

This approach uses well-known Git tools. It is because Git has an innate ability to do this. All we need to add is some convention.

Also you can see code explanation in Cheat-sheet for implementation

Glossary

Glossary

Features

  • Synchronizations of git-tags was eliminated to allow GitLab block them freelly.
  • It is impossible to delete branch of another side. Such branches will be restored.
  • Auto conflict resolving by Convention over Git (non-fast-forward branch conflicts).
  • Prevention of an occasional deletion of an entire repository.
  • Failover & auto recovery of synchronization. Especially for network troubles.
  • Solution is applied per-repository (vs per-server)
  • It has been downgraded here to use two remote Git repositories for clarity, but it can work with many.
  • Bare Git repositories are used for synchronization.

Limitations

  • Do only a single commit to another repository side per the sinchronization interval.