Speedy Git
I was hanging out in the #emacs IRC channel on Libera and there was some chat about using git repository mirrors because GNU's Savannah servers are over-loaded due to AI scrapers and the like. I mentioned that I have git set up to do a first pull from Github, because I don't mind wasting Microsoft's bandwidth, then "topping up" from Savannah and Corwin Brust asked about it, so here's a wee write up.
I'm going to create a brand new clone of the Emacs repo on my machine, but it's simple enough to do this on an existing repo.
mkdir emacs
cd emacs
git init .Add Savannah as "origin".
git remote add origin https://git.savannah.gnu.org/git/emacs.git
Doing a git fetch at this stage took so long I got bored
waiting.
Now add a faster mirror. This may not always be up-to-date, so be aware of that.
git remote add gh https://github.com/emacs-mirror/emacs.git
And now you can git fetch gh for a quick1 update.
At this point git fetch --all will fetch from both Github and
Savannah, but it appears to do it in the order they're configured. We
want to pull from Github first to take some load off Savannah, so we
create a group, defined in the order we want.
# Create a group called "all"
git config remotes.all "gh origin"
And now git fetch all, not --all, will use the members of the
group in the order we defined, so we download the bulk of the updates
from Github, then grab any remaining from Savannah. There's a decent
chance it won't actually download anything from Savannah, but you know
you're up-to-date anyway!
Moar Speed!!!
Github is more than capable of completely maxing out my internet connection, but if you have a very fast connection it might be worth adding multiple mirrors.
Add SourceHut as a mirror and create a group called "fast", which doesn't include Savannah.
git remote add sh https://git.sr.ht/~emacs/emacs
git config remotes.fast "gh sh"Now you can fetch from them simultaneously, which should be faster2.
git fetch --multiple -j 0 fastYou can include groups within groups, so you could set up "all" like so:
git config remotes.all "fast origin"