mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
devvm's ssh for a --clone VM's seed push and rm's fetch read devvm's ssh config, so a url.*.insteadOf, pushInsteadOf or remote URL in the repo's config could send them to another host; only the pinned host key (HostKeyAlias, BatchMode) stood in the way. Their GIT_SSH_COMMAND (gitSSHCommand) is now a shell function that ignores the host, port and options git passes, and runs ssh with vmssh.SSH's new CommandArgs: no ssh config (-F none), the VM's loopback port, user and key from vmssh.FromTarget, and the host keys pinned for its current start (vmssh.KnownHostsFor) under HostKeyAlias, with BatchMode and nothing forwarded. In the VM it runs only git-receive-pack or git-upload-pack, whichever git's last argument asks for, on the clone's own path; anything else fails without ssh. Links' linkSSH is now Env's ownSSH, which both use. Tests: TestUpCloneInsteadOf (failed on the previous code), TestGitSSHCommand, TestForwarderSSH's command args, clone.txtar's push past an insteadOf, and e2e's clone section (an insteadOf on the first push, and a git worktree's clone with only its branch and upstream). Co-Authored-By: Claude Opus 5.5 <[email protected]>