Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Windows Runner Clone Submodules

Rik Bruns
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 11, 2022


I have followed this guide to setup a self hosted Windows Runner. The runner is working however there is an issue when cloning submodules.  The pipeline fails due to permission issue.

git submodule update --init --recursive


Host key verification failed.

fatal: Could not read from remote repository.

The SSH key section on the Windows Runner guide is a bit hard to follow.  It is unclear after step 5 where certain steps should happen (Remote Host, Virtual Machine, etc...).  I have generated a key set in PowerShell on the Windows machine.  I converted and copied the private key into a secret variable.  Trying to load the key in the example step results in a configuration error.

- [Text.Encoding]::ASCII.GetString([Convert]::FromBase64String($Env:MY_SSH_KEY)) > ./id_rsa - ssh -i ./id_rsa <user>@<host> 'echo "connected from pipelines"'

There is a YAML syntax error in your bitbucket-pipelines.yml at [line 11, column 28]. To be precise: expected <block end>, but found '<scalar>'

We have several other repos with submodules using Pipelines with Linux Docker images with no problems.  We set the Access Keys up as directed and all works well. 

Any guidance on how to clone the full repo (with submodules) on a Windows Runner would be helpful.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 14, 2022

Hi Rik,

The error you mention in the beginning, Host key verification failed., means that the host key of is not in the ~/.ssh/known_hosts file of the machine where you have the Windows runner.

You can run the following command in PowerShell:

ssh-keyscan -t rsa

and then copy-paste the output in the ~/.ssh/known_hosts file of the Windows machine where you run the runner. If the file doesn't exist, you can create it.


Regarding the SSH keys, you said you have converted and copied the private key into a secret variable.
Make sure you add the public key to the submodule's Access keys.


The command from our documentation to decode the variable and create the private key file during the build is giving me an error as well, I'll need to check with our development team about this.

In the meantime, I managed to get around this error by including the command to convert in parentheses as follows

- ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String($Env:my_ssh_key))) | Out-File -Encoding "ASCII" id_rsa

I am also creating the private key file in a different way than the documentation's command, as that was giving me an error later on when cloning the submodule, about the key's format.

The following command is needed to make sure that Git will use the SSH key that was created during the build:

- $Env:GIT_SSH_COMMAND='ssh -i ./id_rsa -vvv'

To sum it all up, the following YAML file should work:

- step:
- self.hosted
- windows
- ([Text.Encoding]::ASCII.GetString([Convert]::FromBase64String($Env:my_ssh_key))) | Out-File -Encoding "ASCII" id_rsa
- $Env:GIT_SSH_COMMAND='ssh -i ./id_rsa -vvv'
- git submodule update --init --recursive

Please feel free to let me know how it goes and if you need further assistance.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events