{"record":{"id":"567471ebf2d84b9b","repo":"BigPizzaV3/CodexPlusPlus","slug":"cannot-run-remote-git-over-ssh-error","errorCode":null,"errorMessage":"Cannot run remote git over SSH: {error}","messagePattern":"Cannot run remote git over SSH: (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/upstream_worktree/remote.rs","lineNumber":103,"sourceCode":"    RemoteGitCommand {\n        destination: ssh_destination(target),\n        port: target.port,\n        command: remote_command,\n    }\n}\n\nfn spawn_remote_git(command_spec: &RemoteGitCommand) -> Result<GitOutput, std::io::Error> {\n    let mut command = Command::new(\"ssh\");\n    command.arg(\"-o\").arg(\"BatchMode=yes\");\n    command.arg(\"-o\").arg(\"ConnectTimeout=8\");\n    if let Some(port) = command_spec.port {\n        command.arg(\"-p\").arg(port.to_string());\n    }\n    command\n        .arg(&command_spec.destination)\n        .arg(&command_spec.command);\n    let output = command.output().map_err(|error| {\n        std::io::Error::new(\n            error.kind(),\n            format!(\"Cannot run remote git over SSH: {error}\"),\n        )\n    })?;\n    Ok(GitOutput {\n        status_success: output.status.success(),\n        stdout: String::from_utf8_lossy(&output.stdout).trim().to_string(),\n        stderr: String::from_utf8_lossy(&output.stderr).trim().to_string(),\n    })\n}\n\nfn remote_git(project: &UpstreamRemoteProject, args: &[&str]) -> UpstreamWorktreeResult<GitOutput> {\n    let target = resolve_ssh_target_for_host_id(&project.host_id, None).map_err(|error| {\n        UpstreamWorktreeError::new(UpstreamWorktreeCode::GitMissing, error.to_string())\n    })?;\n    let command_spec = remote_git_command(project, &target, args);\n    let output = spawn_remote_git(&command_spec).map_err(|error| {\n        UpstreamWorktreeError::new(UpstreamWorktreeCode::GitMissing, error.to_string())","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/upstream_worktree/remote.rs#L85-L121","documentation":"spawn_remote_git builds an ssh command to run git remotely and calls command.output(). If the ssh process itself cannot be spawned or awaited (the OS fails to start it), the error is re-wrapped as \"Cannot run remote git over SSH: {error}\" preserving the original kind. This indicates an environment/spawn problem, not a remote git failure (non-zero exit is reported via status_success instead).","triggerScenarios":"Calling remote_git or remote_shell when the ssh binary is missing from PATH, the command spec is malformed so the OS refuses exec, or permission/exec-format issues prevent spawning ssh.","commonSituations":"ssh not installed or not on PATH; ssh binary not executable; wrong port/destination values causing argument construction to fail; containerized/CI environments lacking openssh-client; Windows without an ssh in PATH.","solutions":["Verify ssh is installed and on PATH: run `ssh -V`","Check the remote git command spec (destination, port, command) for malformed values","Ensure the ssh binary has execute permission (chmod +x) and matches the platform","Install openssh-client in the environment (e.g. apt-get install openssh-client in CI images)"],"exampleFix":"// before\nlet output = command.output().map_err(|error| {\n    std::io::Error::new(error.kind(), format!(\"Cannot run remote git over SSH: {error}\"))\n})?;\n// after\n// validate ssh availability first\nwhich::which(\"ssh\").map_err(|_| std::io::Error::new(\n    std::io::ErrorKind::NotFound, \"ssh binary not found on PATH\"))?;\nlet output = command.output().map_err(|error| {\n    std::io::Error::new(error.kind(), format!(\"Cannot run remote git over SSH: {error}\"))\n})?;","handlingStrategy":"validation","validationCode":"if (!process.env.PATH?.split(path.delimiter).some(d => fs.existsSync(path.join(d, 'ssh')))) {\n  throw new Error('ssh not found on PATH');\n}","typeGuard":"const sshAvailable = (): boolean => { try { require('child_process').execSync('ssh -V', {stdio:'ignore'}); return true; } catch { return false; } };","tryCatchPattern":"match remote_git(spec) {\n    Err(e) if e.to_string().starts_with(\"Cannot run remote git over SSH\") => {\n        eprintln!(\"ssh spawn failed: {e}; check PATH and ssh install\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Install openssh-client in base/CI images that use remote git","Sanity-check ssh presence at app startup and degrade gracefully","Validate command_spec destination/port before building the ssh command"],"tags":["ssh","git","process-spawn","remote"],"backgroundTag":"command-not-found","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}