Git submodule changes

There have been some significant changes in the way github handles submodules that have impacted the ArduPilot project. The changes are described in this github blog post:

What I’ll describe below is how this impacts ArduPilot and how you can fix your developer checkouts of ArduPilot to avoid the problem.

The git:// protocol

One of the earliest protocols supported by the git version control system was the git:// protocol. It is a read-only protocol and doesn’t require any authentication. ArduPilot made extensive use of the git:// protocol for submodules (repositories of code that ArduPilot depends on and are included in ArduPilot via a submodule reference).
We used the git:// protocol because at the time we created these submodules github had very poor access control granularity, so if we wanted a developer to be able to label pull requests then we had to give them full write access. For developers who were new to git this was risky as a mistake in a git command could do a lot of damage. By using the git:// protocol the user was less likely to do accidental damage as the submodules were read-only until they explicitly changed them to read-write.

What Happened

As of yesterday github intermittently stopped supporting the git:// protocol via a deliberate set of “brownouts” designed to force projects to change to the https:// protocol. This resulted in a lot of failed CI jobs, and developers unable to work with their existing git clones. It also impacts all our old stable branches. These brownouts will become permanent next year (see the link at the top of this post for a schedule).

What have we done

We have applied patches to the master branch and the stable 3.6, 3.9, 4.0 and 4.1 branches to change our git submodules to use the https:// protocol. That avoids the issue but leaves vendors and developers who have their own branches with the issue still happening.
You will know if you have the issue as you will get messages like this:

The key line is this “The unauthenticated git protocol on port 9418 is no longer supported”.

Quick FIx
The quick fix is to configure git to automatically use https:// whenever it goes to use the git:// protocol. You can do that by running this command:

git config --global url.https://github.insteadOf git://github

what that will do is add the following to your .gitconfig file in your home directory:

[url "https://github"]
        insteadOf = git://github

This fix is great for individual developers. For a more complete fix which applies to your whole dev team see the next section.

Fixing your branches

If you have a git checkout of either your own branch or one of the ArduPilot stable branches then you can fix it by applying a single patch then running a “sync” script to fix your submodules.
The patches you need are in the following pull requests:

You can “cherry pick” the last patch from the appropriate branch in those PRs to fix the issue.

submodule sync script

After applying the patch you need to run this script:


which will run the git submodule sync command to fix your checkout.


For old checkouts that still do not have those commits it might be easier to apply a single global config:

git config --global url.“https://github”.insteadOf git://github

So git will automatically transform the former into the latter when fetching.

interesting, I wasn’t aware of the insteadOf functionality. I just tried it and it didn’t seem to do anything on an existing checkout which has git:// in .gitmodules. It also didn’t change .git/config, so I’m a bit unclear on how this works.

ahh, of course, its --global, so it added this in ~/.gitconfig

[url "“https://github”"]
        insteadOf = git://github


yep, --global so it changes ~/.gitconfig and applies to any repo that is fetching from github. Since from the text above it sounds like github is closing git:// protocol, it may be a good idea to leave this config there.

$ GIT_CURL_VERBOSE=1 git ls-remote git://
21:45:48.873103 http.c:756              == Info:   Trying
21:45:48.873271 http.c:756              == Info: Connected to ( port 443 (#0)

I have this on my ~/.gitconfig for a long time for other reasons (working behind a company proxy that forbids git://)

thanks Lucas! I’ve added it to the original blog post as “Quick Fix”. Much appreciated!