Skip to content

Commit 36f2cc7

Browse files
committed
Replace StrictHostKeyChecking=accept-new with BatchMode=yes
1 parent 6dc0aef commit 36f2cc7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/opts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ const askPassSetInEnv = process.env.GIT_ASKPASS !== undefined
3636
const { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs()
3737

3838
// Values we want to set if they're not already defined by the end user
39-
// This defaults to accepting new ssh host key fingerprints
39+
// This defaults to disabling user interaction with BatchMode
4040
const finalGitEnv = {
4141
...(askPassSetInEnv || askPassSetInConfig ? {} : {
4242
GIT_ASKPASS: 'echo',
4343
}),
4444
...(sshCommandSetInEnv || sshCommandSetInConfig ? {} : {
45-
GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',
45+
GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
4646
}),
4747
}
4848

test/opts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ t.test('defaults', t => {
2424
t.match(gitOpts(), {
2525
env: {
2626
GIT_ASKPASS: 'echo',
27-
GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',
27+
GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
2828
},
2929
shell: false,
3030
}, 'got the git defaults we want')
@@ -45,7 +45,7 @@ t.test('handle case when fs.existsSync throws an error', t => {
4545
t.match(gitOptsWithMockFs(), {
4646
env: {
4747
GIT_ASKPASS: 'echo',
48-
GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',
48+
GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
4949
},
5050
shell: false,
5151
}, 'should apply defaults when fs.existsSync throws an error')
@@ -64,7 +64,7 @@ t.test('handle case when git config does not exist', t => {
6464
t.match(gitOptsWithMockFs(), {
6565
env: {
6666
GIT_ASKPASS: 'echo',
67-
GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',
67+
GIT_SSH_COMMAND: 'ssh -o BatchMode=yes',
6868
},
6969
shell: false,
7070
}, 'should apply defaults when git config does not exist')

0 commit comments

Comments
 (0)