I have a remote git repository with big history and slow connection channel. Where are some local users, and slow push/pull after big commits or cloning from scratch for new users are big problems, now. I want to create local mirror of it. Local changes must be committed to local repo, and sync with remote in background. I understand that this problem is in demand, but I have not found any solution yet (I am not admin of remote repo, I just try to simplify local work with it).
The difference is that when using --mirror , all refs are copied as-is. This means everything: remote-tracking branches, notes, refs/originals/* (backups from filter-branch). The cloned repo has it all. It's also set up so that a remote update will re-fetch everything from the origin (overwriting the copied refs).
Repository Mirroring is a way to mirror repositories from external sources. It can be used to mirror all branches, tags, and commits that you have in your repository. Your mirror at GitLab will be updated automatically. You can also manually trigger an update at most once every 5 minutes.
Since you write in the comments that the people behind the slow connection would be doing most of the work, I would suggest you setup the slow remote site to be a mirror of your local repo you would commit against.
First make a bare clone of slow remote on a local server
$ git clone --bare git://slow/repo.git
You local people should now only commit to that clone, not the slow remote.
Then set up a cron job or something similar to push changes in your local repo to the slow site with
$ git push origin --mirror
By using --mirror
you tell git to push all branches and tags.
You should be able to make shallow clones with
git clone --depth=20 url-to-your-repo some-path
This should allow you to not bother with most of the history.
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