Skip to content

Commit 4160975

Browse files
committed
feat(ssh): add StrictHostKeyChecking=no
add StrictHostKeyChecking=no Signed-off-by: mritd <[email protected]>
1 parent 054b71d commit 4160975

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

consts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ const commitMessageCheckFailedMsg = `
3737
│ │
3838
╰──────────────────────────────────────────────────╯`
3939

40-
const luckyCommitEnv = "LUCKY_COMMIT"
40+
const luckyCommitEnv = "MMH_LUCKY_COMMIT"
41+
const strictHostKey = "MMH_STRICT_HOST_KEY"

git_wapper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ func git(cmds ...string) (string, error) {
135135
cmd = exec.Command("git", cmds...)
136136
}
137137

138+
luckyPrefix := os.Getenv(strictHostKey)
139+
if luckyPrefix != "true" {
140+
cmd.Env = append(os.Environ(), "GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no")
141+
}
142+
138143
bs, err := cmd.CombinedOutput()
139144
if err != nil {
140145
if bs != nil {

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.1.3
1+
v2.1.4

0 commit comments

Comments
 (0)