I want to mirror a git repo to my local repo, and wish to timely sync them, I did like this:
git clone --mirror source_url source_repo
cd source_repo
git push --mirror local_url
Now I have mirrored the source repo to my local repo, I could clone my local repo like this:
git clone local_url local_repo
But since the source repo is going update, how could I keep them sync?
You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.
Any local repository, either mirrored or working, can be synced with git remote update
cd REPO
git remote update
Exactly for this purpose I created git-sync-mirror.
git-sync-mirror
A simple synchronization container image for git repositories over HTTPS
Features:
- Authentication with https tokens
- If needed, 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 source with https://github-user:[email protected]/Enteee/git-sync-mirror.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With