@@ -279,7 +279,7 @@ func TestGitGetter_sshKey(t *testing.T) {
279
279
encodedKey := base64 .StdEncoding .EncodeToString ([]byte (testGitToken ))
280
280
281
281
// avoid getting locked by a github authenticity validation prompt
282
- os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no" )
282
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes " )
283
283
defer os .Setenv ("GIT_SSH_COMMAND" , "" )
284
284
285
285
u ,
err := urlhelper .
Parse (
"ssh://[email protected] /hashicorp/test-private-repo" +
@@ -309,7 +309,7 @@ func TestGitGetter_sshSCPStyle(t *testing.T) {
309
309
encodedKey := base64 .StdEncoding .EncodeToString ([]byte (testGitToken ))
310
310
311
311
// avoid getting locked by a github authenticity validation prompt
312
- os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no" )
312
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes " )
313
313
defer os .Setenv ("GIT_SSH_COMMAND" , "" )
314
314
315
315
// This test exercises the combination of the git detector and the
@@ -350,7 +350,7 @@ func TestGitGetter_sshExplicitPort(t *testing.T) {
350
350
encodedKey := base64 .StdEncoding .EncodeToString ([]byte (testGitToken ))
351
351
352
352
// avoid getting locked by a github authenticity validation prompt
353
- os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no" )
353
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes " )
354
354
defer os .Setenv ("GIT_SSH_COMMAND" , "" )
355
355
356
356
// This test exercises the combination of the git detector and the
@@ -391,7 +391,7 @@ func TestGitGetter_sshSCPStyleInvalidScheme(t *testing.T) {
391
391
encodedKey := base64 .StdEncoding .EncodeToString ([]byte (testGitToken ))
392
392
393
393
// avoid getting locked by a github authenticity validation prompt
394
- os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no" )
394
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes " )
395
395
defer os .Setenv ("GIT_SSH_COMMAND" , "" )
396
396
397
397
// This test exercises the combination of the git detector and the
@@ -499,7 +499,7 @@ func TestGitGetter_setupGitEnvWithExisting_sshKey(t *testing.T) {
499
499
}
500
500
501
501
// start with an existing ssh command configuration
502
- os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no" )
502
+ os .Setenv ("GIT_SSH_COMMAND" , "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes " )
503
503
defer os .Setenv ("GIT_SSH_COMMAND" , "" )
504
504
505
505
cmd := exec .Command ("/bin/sh" , "-c" , "echo $GIT_SSH_COMMAND" )
@@ -510,7 +510,7 @@ func TestGitGetter_setupGitEnvWithExisting_sshKey(t *testing.T) {
510
510
}
511
511
512
512
actual := strings .TrimSpace (string (out ))
513
- if actual != "ssh -o StrictHostKeyChecking=no -i /tmp/foo.pem" {
513
+ if actual != "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes - i /tmp/foo.pem" {
514
514
t .Fatalf ("unexpected GIT_SSH_COMMAND: %q" , actual )
515
515
}
516
516
}
0 commit comments