Giter Club home page Giter Club logo

git-sync-mirror's Introduction

git-sync-mirror GitHub Workflow Status (branch) Docker Pulls

A container image for synchronizing git repositories over HTTPS

Features:

  • Authentication with https tokens
  • Two way synchronization
  • Delete branches on destination once they were delted at the source (prune)
  • Use a different HTTPS Proxy for source and destination
  • TLS-Trust On First Use: Seamlessly run this container behind a https scanning proxy
  • Skip certificate checks (don't do that)
  • Configure time to sleep between synchronization attempts

Usage

$ docker run \
  --rm \
  --env SRC_REPO=source \
  --env DST_REPO=destination \
  --env SLEEP_TIME=30s \
  enteee/git-sync-mirror

Note: The container is designed for synchronization over https with supported authentication using access tokens. For example replace SRC_REPO_TOKEN with your GitHub Access token and SRC_REPO_TOKEN_USER with your GitHub user name.

Environment Variables

Variable Description Mandatory Example
SRC_REPO Source repository Yes https://github.com/Enteee/git-sync-mirror.git
DST_REPO Destination repository Yes https://github.com/Enteee/git-sync-mirror.git
SRC_LOCAL_REPO Local source repository No, default: Temporary directory ExampleProject/FilePath
DST_LOCAL_REPO Local destination repository No, default: Temporary directory ExampleProject/FilePath
SRC_REPO_TOKEN Source repository token No, default `` 9a91fa018231aaffbbc1231.....
DST_REPO_TOKEN Destination repository token No, default `` 9a91fa018231aaffbbc1231.....
SRC_REPO_TOKEN_USER Source repository token user No, default `` YourGithubUser
DST_REPO_TOKEN_USER Destination repository token user No, default `` YourGithubUser
DEBUG Print debug output. WARNING: This will also print http tokens! No, default: false true or false
PRUNE Delete branches and tags on DST once they were deleted in SRC No, default: false true or false
TWO_WAY Mirror both ways. First SRC to DST, then the other way around No, default: false true or false
GIT_FORCE_PUSH Pushes with git option --force. This makes sense when you sometimes use force push in your git workflow No, default: false true or false
HTTP_TLS_VERIFY Enable/Disable certificate cheks No, default: true true or false
HTTP_SRC_PROXY HTTP Proxy to use when connecting to SRC_REPO No, default: `` http://localhost:8080
HTTP_DST_PROXY HTTP Proxy to use when connecting to DST_REPO No, default: `` http://localhost:8080
HTTP_ALLOW_TOKENS_INSECURE Allow authentication tokens over HTTP. IMPORTANT: This is very dangerous. Always use HTTPS! No, default: false true or false
ONCE If set to true, only mirror the repository once No, default: false true or false
SLEEP_TIME Time to sleep between synchronizations No, default: 60s 30m
IGNORE_REFS_PATTERN Don't mirror matching refs. Ignoring multiple refs is possible by separating them with spaces. No, default: refs/pull refs/pull
TLS_TOFU Enable / Disable TLS-Trust On First Use No, default: false true or false

git-sync-mirror's People

Contributors

enteee avatar peter30-hun avatar rubycut avatar stefan1242 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

git-sync-mirror's Issues

Sync fails (when rebasing and force pushing branch)

Hi guys!

Its not really an issue, its the correct behaviour of git, but it prevents a sync.
When you push a new branch and later you rebase it and make a force push to your "SOURCE_REPO", than the sync must be also make a force push, otherwise the push will be rejected.

So it would be great if there are an option to force push instead of plain push in the sync() method.
So user can decide if he needs force push or not.

Support HTTP protocol

I have a repo which for some reason doesn't use HTTPS. As I see in the logs, there is a regex which assumes HTTPS by default:

sed -nre 's|^\s*https://(.+)|https://wbadmin:wbadmin@\1|ip'
...
SRC_REPO=

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.