Skip to main content

An executable to clone git repos from one git server to another.

Project description

Git Mirror

PyPi Badge Publish Test Downloads Downloads Downloads

git-mirror is part of the pygitmirror Python package. git-mirror is an executable to clone git repos from one git server to another.

Installation

To install pygitmirror into your Python environment:

pip install -U pygitmirror

The package exposes a single executable git-mirror which is used to systematically mirror your git repos from one git server to another.

Usage

After installing pygitmirror, you can call the git-mirror executable to clone/mirror your git repository between two git servers:

git-mirror --source_url <source git server URL> --destination_url <destination git server URL> --org <organization or project name> --repo <repo name>

git-mirror will use the current directory to check out your source repository and pushes all branches in it to its new location at the destination. Note, the destination repository needs to already exist at the destination server, albeit being empty!

To use a custom sync/temporary path:

git-mirror --sync_path <custom sync path> ..

To mirror multiple repositories at once, you should use the JSON file option:

{
  "sync_path": "<local path for sync>",
  "source_url": "ssh://<source-git-server>:<source port> or https://<source-server>",
  "destination_url": "ssh://<destination-git-server> or https://<destination-server>",
  "repos": {
    // comments are allowed at the beginning
    "organization-1": [
      // comments are allowed at the beginning
      "repo-1",
      "repo-2",
      "..."
    ],
    "organization-2": ["repo-3", "repo-4", "..."]
  }
}

Note: JSON file entries supersede the other command line arguments.

To get a list of all available parameters:

git-mirror -h

Development

To clone the library for development:

git clone https://github.com/pygitmirror/pygitmirror.git

or

git clone git@github.com:pygitmirror/pygitmirror.git

Build The Virtual Environment

The current earliest Python version supported is 3.9. You need to be able to create a virtual environment at this version to make sure any changes you make is compatible.

If you are using conda:

conda create --prefix=.venv python=3.9 --yes

If you are using venv, make sure you have the right base package:

>> python --version
Python 3.9.x

Once you verify your base Python, you can then create a virtual environment using:

virtualenv -p py3.9 .venv

Setup

Once you have created your virtual environment and made sure it is active in your current command line:

python3 -m pip install --upgrade pip
pip install -e .[dev]

This should all the dependencies you need for developing into the library and also allow you to run the unit tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygitmirror-0.0.2.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

pygitmirror-0.0.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file pygitmirror-0.0.2.tar.gz.

File metadata

  • Download URL: pygitmirror-0.0.2.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pygitmirror-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bb52fb8b102d8573288b3cb1c1f9491a44261ba563d1eeb3e5b6b46d4d055f4a
MD5 4470d92c7ca9bc6a09dfd4de9a8a03e0
BLAKE2b-256 e4e5067dfbb2e26628557322d8ee815e1e8221fead46fda5323ecba502277516

See more details on using hashes here.

File details

Details for the file pygitmirror-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pygitmirror-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pygitmirror-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfb6a7a4375dba19c6ff8aecc59cfe9c1b9ac739538ea16ba90c7bbebf848aa
MD5 fbce8f9c9f56f44c933daa833733dc6b
BLAKE2b-256 6621f2db816fd5d0db4b31885783ae929ff08351282138e1b485ffcb3dd5ad7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page