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:
- git: changed submodule protocols to https:// for master by tridge · Pull Request #19109 · ArduPilot/ardupilot · GitHub
- git: changed to https git protocol for copter4.1 by tridge · Pull Request #19118 · ArduPilot/ardupilot · GitHub
- git: changed to https protocol for plane 4.1 by tridge · Pull Request #19111 · ArduPilot/ardupilot · GitHub
- git: changed protocol to https for copter-4.0 by tridge · Pull Request #19113 · ArduPilot/ardupilot · GitHub
- git: changed protocol to https for copter-4.0 by tridge · Pull Request #19113 · ArduPilot/ardupilot · GitHub
- git: changed to https git protocol for plane3.9 by tridge · Pull Request #19114 · ArduPilot/ardupilot · GitHub
- git: changed to https git protocol for Copter-3.6 by tridge · Pull Request #19115 · ArduPilot/ardupilot · GitHub
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:
Tools/gittools/submodule-sync.sh
which will run the git submodule sync command to fix your checkout.