Gitlab runner GIT_SSH_COMMAND enviroment variable

Hi Guys… need a hint.

In a gitlab runner I try to set GIT_SSH_COMMAND for win machine (no docker) in gitlab-ci.yml
If I set it in beforescript part as
${env:GIT_SSH_COMMAND} = ‘ssh -vvv -i “C:\Users\te\.ssh\id_rsa” -o UserKnownHostsFile=C:/Users/te/.ssh/known_hosts’
it works.

however I would like to set it in variables (as we do for linux pipelines)
env:GIT_SSH_COMMAND : ‘ssh -vvv -o UserKnownHostsFile=c:/Users/te/.ssh/known_hosts -i “c:\Users\te.ssh\id_rsa”’

It works only partially. UserKnownHostFile is just ignored. Everything else works.

If it is relevant, the runner runs powershell, not cmd.

What happens?

By trial and error I discovered that it might depend on how I pass the paths ( \ vs / vs \, what quation marks I use…)

But I am unable to figure out how to make it work.

1 Like