@@ -28,7 +28,7 @@ import { HeartbeatManager } from './heartbeat';
28
28
import { getGitpodVersion , isFeatureSupported } from './featureSupport' ;
29
29
import SSHConfiguration from './ssh/sshConfig' ;
30
30
import { isWindows } from './common/platform' ;
31
- import { untildify } from './common/files' ;
31
+ import { resolveHomeDir , untildify } from './common/files' ;
32
32
33
33
interface SSHConnectionParams {
34
34
workspaceId : string ;
@@ -440,7 +440,7 @@ export default class RemoteConnector extends Disposable {
440
440
identityFiles . push ( ...DEFAULT_IDENTITY_FILES ) ;
441
441
}
442
442
443
- const identityFileContentsResult = await Promise . allSettled ( identityFiles . map ( async path => fs . promises . readFile ( path + '.pub' ) ) ) ;
443
+ const identityFileContentsResult = await Promise . allSettled ( identityFiles . map ( async path => fs . promises . readFile ( resolveHomeDir ( path ) + '.pub' ) ) ) ;
444
444
const fileKeys = identityFileContentsResult . map ( ( result , i ) => {
445
445
if ( result . status === 'rejected' ) {
446
446
return undefined ;
@@ -462,14 +462,20 @@ export default class RemoteConnector extends Disposable {
462
462
} ;
463
463
} ) . filter ( < T > ( v : T | undefined ) : v is T => ! ! v ) ;
464
464
465
- const sshAgentSock = isWindows ? `\\.\pipe\openssh-ssh-agent` : ( hostConfig [ 'IdentityAgent' ] || process . env [ 'SSH_AUTH_SOCK' ] ) ;
465
+ let sshAgentSock : string | undefined ;
466
+ if ( isWindows ) {
467
+ sshAgentSock = `\\.\pipe\openssh-ssh-agent` ;
468
+ } else {
469
+ sshAgentSock = ( hostConfig [ 'IdentityAgent' ] || process . env [ 'SSH_AUTH_SOCK' ] ) ;
470
+ sshAgentSock = resolveHomeDir ( sshAgentSock ) ;
471
+ }
466
472
let sshAgentParsedKeys : ParsedKey [ ] = [ ] ;
467
473
try {
468
- if ( ! sshAgentSock ) {
469
- throw new Error ( `SSH_AUTH_SOCK environment variable not defined` ) ;
470
- }
471
-
472
474
sshAgentParsedKeys = await new Promise < ParsedKey [ ] > ( ( resolve , reject ) => {
475
+ if ( ! sshAgentSock ) {
476
+ reject ( new Error ( `SSH_AUTH_SOCK environment variable not defined` ) ) ;
477
+ return ;
478
+ }
473
479
const sshAgent = new OpenSSHAgent ( sshAgentSock ) ;
474
480
sshAgent . getIdentities ( ( err , publicKeys ) => {
475
481
if ( err ) {
0 commit comments