node 处理 The authenticity of host '' can't be established.
发布于 5 年前 作者 meooxx 2247 次浏览 来自 问答

The authenticity of host ‘github.com (13.250.177.223)’ can’t be established. RSA key fingerprint is SHA256:xxxxxxxxxxxxxxx Are you sure you want to continue connecting (yes/no)? Host key verification failed.

这段提示为什么 stdout.on(‘data’) stderr.on(‘data’) 都获取不到


const sub = cp.spawn(
    'bash', 
    {
      cwd: `${rootDir}/gh-pages`
    }
  )

  sub.stderr.setEncoding('utf-8')
  sub.stdout.setEncoding('utf-8')

  try {
    await sub.stdin.write(`
      pwd \n
      git init \n
      git config user.name "xxx"
      git config user.email "xxxx48@gmail.com"
      git remote add origin ${gitAddr} \n
      git add . \n
      git commit -m "gh-pages" \n
      git status \n
      git push origin HEAD:gh-pages -f \n
    `)
   // await  sub.stdin.end()

  }catch(err) {
    console.log("err: ", err)
  }
  


  sub.stdout.on("data", (data) => {
    console.log("onData:", data)
   
  })

  sub.on('exit', (...rest)=> {
    try{sub.stdin.write('yes\n')}
    catch(err) {
      console.log("exit err: ", err, rest)
    }
  })

  
  sub.stderr.on('data', data=>{
    console.log('stderr: ', data)
    process.exit(1)

  })

}
回到顶部