Conversation
Three issues prevented git push over SSH from working inside the microVM: 1. Missing ~/.ssh/known_hosts — the guest had no host keys for github.com, gitlab.com, or bitbucket.org, causing SSH to reject connections with "Host key verification failed". Added a new InjectSSHKnownHosts rootfs hook that writes verified host keys (ed25519, ecdsa, rsa) for all three providers. 2. URL sanitizer stripping SSH usernames — sanitizeURL treated all url.User info as credentials and stripped it, turning ssh://git@github.com/org/repo into ssh://github.com/org/repo. Fixed to only strip user info when a password is present. 3. Missing insteadOf URL rewrites — the host's global gitconfig [url "git@github.com:"].insteadOf rules were not forwarded to the guest, so repos with HTTPS remotes that relied on host-side rewriting to SSH could not use SSH agent forwarding. Added URLRewrite parsing to HostIdentityProvider and injection into the guest's .gitconfig. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
eb21446 to
db5fb1a
Compare
jhrozek
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three issues prevented
git pushover SSH from working inside the microVM, even though SSH agent forwarding was correctly set up by go-microvm v0.0.23:Missing
~/.ssh/known_hosts— the guest had no host keys for github.com, gitlab.com, or bitbucket.org, causing SSH to reject connections with "Host key verification failed". AddedInjectSSHKnownHostsrootfs hook with verified keys (ed25519, ecdsa, rsa) for all three providers.URL sanitizer stripping SSH usernames —
sanitizeURLtreated allurl.Userinfo as credentials, turningssh://git@github.com/org/repointossh://github.com/org/repo. Fixed to only strip when a password is present; username-only URLs (SSH key auth) are preserved.Missing
insteadOfURL rewrites — the host's global~/.gitconfig[url "git@github.com:"].insteadOfrules were not forwarded to the guest. Repos with HTTPS remotes that relied on host-side rewriting to SSH could not use SSH agent forwarding. AddedURLRewriteparsing toHostIdentityProviderand injection into the guest.gitconfig.Test plan
SSH_AUTH_SOCKis set inside the VMssh -T git@github.comauthenticates successfully (known_hosts + agent forwarding)git remote -vshows SSH URL via insteadOf rewrite~/.gitconfiginside guest contains the[url].insteadOfruleTestInjectSSHKnownHosts_*,TestParseURLRewrites,TestHostIdentityProvider_URLRewrites, sanitizer SSH URL tests)🤖 Generated with Claude Code