3

I have a script with this snippet:

ssh-agent bash -c "ssh-add $SOME_KEY; \
                   git submodule update --init foo"

The script hangs while asking the user:

RSA key fingerprint is SHA256:[the fingerprint]

Are you sure you want to continue connecting (yes/no)?

How can I make the script continue (with a yes)?


  • I know that I can invoke ssh -o StrictHostKeyChecking=no to disable this but I'm calling git not ssh.

  • I know that I can configure ~/.ssh/config to disable strict key checking for that host--but I don't want to modify the user's system.

  • I know that I can chmod 000 ~/.ssh/known_hosts to disable key checking for that user, but I don't want to modify the user's system

  • I thought I could insert yes | in front of git but it doesn't seem to work.

3

From Stack Overflow, via muru, passing ssh options to git clone:

The recently released git 2.3 supports a new variable "GIT_SSH_COMMAND" which can be used to define a command WITH parameters.

GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone user@host

$GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is interpreted by the shell, which allows additional arguments to be included.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.