From 91dbb7770d33000e1013e1030140cac21d995034 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 14 Nov 2022 22:00:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E9=98=85github=20ss?= =?UTF-8?q?h=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/sshKey.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/back/services/sshKey.ts b/back/services/sshKey.ts index 27bb3a22..4f2e2a74 100644 --- a/back/services/sshKey.ts +++ b/back/services/sshKey.ts @@ -43,12 +43,10 @@ export default class SshKeyService { host: string, proxy?: string, ): string { - if (host === 'github.com' && proxy) { - host = 'ssh.github.com'; + if (host === 'github.com') { + host = `ssh.github.com\n Port 443\n HostkeyAlgorithms +ssh-rsa\n PubkeyAcceptedAlgorithms +ssh-rsa`; } - const proxyStr = proxy - ? ` Port 443\n HostkeyAlgorithms +ssh-rsa\n PubkeyAcceptedAlgorithms +ssh-rsa\n ProxyCommand nc -v -x ${proxy} %h %p\n` - : ''; + const proxyStr = proxy ? ` ProxyCommand nc -v -x ${proxy} %h %p\n` : ''; return `\nHost ${alias}\n Hostname ${host}\n IdentityFile ${this.sshPath}/${alias}\n StrictHostKeyChecking no\n${proxyStr}`; }