0
var project = {repo: 'a', owner: 'b'};
var sys = require('sys');
var exec = require('child_process').exec;

 function getRevision(error, stdout, stderr){
    exec("yes"); // <--- how can I say 'yes' to request from stdout?
    console.log(error, stdout, stderr);
 }

 exec("git ls-remote "+"bitbucket.org:"+project.owner+"/"+project.repo+".git", getRevision);

in console I have

The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)?

How I can say "yes" on this request from console?

sgress454
  • 24,870
  • 4
  • 74
  • 92
KoIIIeY
  • 533
  • 1
  • 7
  • 26

1 Answers1

0

You don't need to say yes to it, you can avoid the prompt completely: Git clone with custom SSH using GIT_SSH error

In short, you need to specify StrictHostKeyChecking=no somewhere when git runs ssh. You can do this in your SSH config file or in more complex ways.

Community
  • 1
  • 1
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • may be you're right but I solve this by adding "git@" before bitbucket.org :) – KoIIIeY Jun 17 '14 at 12:03
  • Well, you do know that once you say "yes" to the prompt once, it won't come back on that same machine? – John Zwinck Jun 17 '14 at 12:18
  • I don't write "yes" to console directly. It's repaired by itself. But how can I send commands to console and answer on requests? – KoIIIeY Jun 18 '14 at 08:28
  • If you really, really want to (and for this application you should not), you can use the program `expect` to interact programmatically with CLI programs. It's just not warranted in this case, and will waste a lot of time if you try. :) – John Zwinck Jun 18 '14 at 09:48