Bruno Haible via Gnulib discussion list <[email protected]> writes:
> Last week I wrote:
>> For submodules, it can be customized via
>>
>> git config --global url.git://git.savannah.gnu.org/.insteadof
>> git://git.git.savannah.gnu.org/
>> git config --global url.https://git.savannah.gnu.org/git/.insteadof
>> https://https.git.savannah.gnu.org/git/
>> git config --global url.git://git.savannah.gnu.org/gnulib.git.insteadof
>> https://github.com/coreutils/gnulib.git
>> git config --global
>> url.https://git.savannah.gnu.org/git/gnulib.git.insteadof
>> https://github.com/coreutils/gnulib.git
>
> I got the syntax wrong. The correct customization commands are:
>
> git config set --global --append
> url.git://git.git.savannah.gnu.org/.insteadOf git://git.savannah.gnu.org/
> git config set --global --append
> url.https://https.git.savannah.gnu.org/git/.insteadOf
> https://git.savannah.gnu.org/git/
> git config set --global --append
> url.https://github.com/coreutils/gnulib.git.insteadOf
> git://git.savannah.gnu.org/gnulib.git
> git config set --global --append
> url.https://github.com/coreutils/gnulib.git.insteadOf
> https://git.savannah.gnu.org/git/gnulib.git
>
> With these commands, "git clone", submodules, and subcheckouts do the
> redirections automatically. Therefore the gitsub.sh patch was not needed.
> I'm reverting it.
The .insteadOf applies for both pushes and pulls right?
Andreas Schwab shared an option that seems like it works better for
maintainers who need to push and pull on emacs-devel [1].
Basically you run the following:
$ git config set --global
url.ssh://git.savannah.gnu.org/srv/git/.pushinsteadof
https://https.git.savannah.gnu.org/git/
Then update all of your clones to refer to the mirror. I used a hastily
written script:
#!/bin/sh
SAVED_PWD=$(pwd)
for file in `find . -name '.git' -type d`; do
cd "$file"/..
url=$(git remote get-url origin)
case $url in
[email protected]*) ;;
*) cd "$SAVED_PWD" && continue ;;
esac
url=$(echo $url | sed
's|[email protected]:/srv/git/|https://https.git.savannah.gnu.org/git/|')
git remote set-url origin "$url"
cd "$SAVED_PWD"
done
The pulls work much faster now, but I haven't had a chance to test that
I can push yet.
I assume you will need to use your ~/.ssh/config to specify your
username like so:
Host git.savannah.gnu.org
User collinfunk
Collin
[1] https://lists.gnu.org/archive/html/emacs-devel/2025-09/msg00395.html