Passing ssh options to git clone

Question:

I’m trying to run git clone without ssh checking the repository host’s key. I can do it from ssh like that:

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:

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.

Leave a Reply