Add skip SSH host key verification and fix self-hosted server support (#121)

* Add SSH host key verification with automatic trust and SCP-style URL support

* Fix TypeScript errors for SSH host key schema and test mocks
This commit is contained in:
Chris Scott authored and GitHub committed 2026-02-11 22:58:13 -05:00
1 parent 677ce748cd
commit 7341dce1ef
25 files changed
+203 -123

No files matched your search

+17 -11
View File
@@ -1,14 +1,4 @@
export interface GitCredential {
name: string
host: string
type: 'pat' | 'ssh'
token?: string
sshPrivateKey?: string
sshPrivateKeyEncrypted?: string
hasPassphrase?: boolean
username?: string
passphrase?: string
}
import type { GitCredential } from '@opencode-manager/shared'
export function isGitHubHttpsUrl(repoUrl: string): boolean {
try {
@@ -40,6 +30,22 @@ export function isSSHUrl(url: string): boolean {
return url.startsWith('git@') || url.startsWith('ssh://')
}
export function normalizeSSHUrl(url: string): string {
if (url.startsWith('ssh://')) {
return url
}
const match = url.match(/^git@([^:]+):(\d{1,5})\/(.+)$/)
if (match) {
const [, host, port, path] = match
const portNum = parseInt(port!, 10)
if (portNum > 0 && portNum <= 65535) {
return `ssh://git@${host}:${port}/${path}`
}
}
return url
}
export function extractHostFromSSHUrl(url: string): string | null {
if (url.startsWith('git@')) {
const match = url.match(/^git@([^:]+):/)