Question:
I’m trying to run git clone
without ssh checking the repository host’s key. I can do it from ssh like that:
1 2 |
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@host |
Is there any way to pass the same ssh options to the git clone command?
Edit: There is a restriction that I can’t modify ~/.ssh/config
or any other files on that machine.
Answer:
Add them to your ~/.ssh/config
:
1 2 3 4 5 6 |
Host host HostName host User user SshOption1 Value1 SshOption2 Value2 |
The Host
entry is what you’ll specify on the command line, and the HostName
is the true hostname. They can be the same, or the Host
entry can be an alias. The User
entry is used if you do not specify user@
on the command line.
If you must configure this on the command line, set the GIT_SSH
environment variable to point to a script with your options in it.