pre-commit "The unauthenticated git protocol ... is no longer supported" in CI
pre-commit cloned a hook repo using the plain git:// protocol and the host now refuses it. GitHub disabled the unauthenticated git protocol, so the fetch fails while setting up the hook.
What this error means
Setting up a hook repo fails with "The unauthenticated git protocol on port 9418 is no longer supported" during the clone step of pre-commit env setup.
fatal: unable to access 'git://github.com/owner/hook-repo/':
The unauthenticated git protocol on port 9418 is no longer supported.Common causes
A hook repo URL uses git:// instead of https://
The repo: in the config, or a global git insteadOf rule, forces the unauthenticated protocol GitHub has disabled.
A git insteadOf rewrite maps https to git protocol
A url.git://.insteadOf config on the runner rewrites clone URLs to the retired protocol.
How to fix it
Use https for hook repos
- Change any
git://repo URLs in the config tohttps://. - Remove any insteadOf rule that forces the git protocol.
- Re-run so the clone uses https.
- repo: https://github.com/owner/hook-repo
rev: v1.2.0
hooks:
- id: my-hookRewrite git protocol to https at the git layer
If a hook repo hardcodes the old protocol, add a global rewrite to https.
git config --global url."https://github.com/".insteadOf "git://github.com/"How to prevent it
- Always reference hook repos over https.
- Avoid insteadOf rules that map to the git protocol.
- Cache PRE_COMMIT_HOME so hook repos are cloned once.