Passing ssh options to git clone

后端 未结 7 976
礼貌的吻别
礼貌的吻别 2020-11-30 23:16

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

ssh -o UserKnownHostsFile=/dev/nul         


        
7条回答
  •  日久生厌
    2020-11-30 23:56

    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.

提交回复
热议问题