Help? How to run build using SSH (Not Https) for CI/CD (Windows Runner)
Asked by Valeriu Ghisoiu:

Hi,

![sshbuildneed.png](/t5/image/serverpage/image-id/343254i9509CD303E416E3D/image-size/large?v=v2&px=999 "sshbuildneed.png")

I would like to ash how can the build run from the beginning, to the end using the SSH key on the machine where the Windows Runner is running.

The main repo somehow it is cloned through the pipeline, but when the submodules are updated the pipeline is failing.

P.S I don't want to set in ".gitmodules" the **URL**: ssh://git@bitbucket.org/subrepo_name....

(This is working, but I want a relative **URL**in the ".gitmodules" like: url = "../subrepo_name".

The error in submodules update is:

"**Please make sure you have the correct access rights and the repository exists.**

**fatal: clone of '** ***<https://bitbucket.org/subrepo_name>*** **" into submodule path: \<local runner path\> failed**

**Failed to clone \<** ***subrepo_name*** **\> Retry scheduled**

**ssh: Could not resolve hostname bitbucket.org:myRepo: Name or service not known**

**fatal: Could not read from remote repository.**"

Thanks so much in advance  
Kind regards,  
Vale


Answers:
author: Patrik S
body: Hello [@Valeriu Ghisoiu](/t5/user/viewprofilepage/user-id/5568129) ,

and thank you for reaching out to the Community.

At the start of a build step, pipelines will by default clone the repository from which the build was triggered. This clone will use HTTPs and is authenticated through OAuth credentials generated automatically by pipeline itself. Unfortunately, it's not yet possible to change the protocol of this clone to SSH instead of HTTPS.

However, as a workaround, you can [disable the pipeline's automatic clone of the repository](https://support.atlassian.com/bitbucket-cloud/docs/git-clone-behavior/), and make this clone manually as part of your step's script, so you have more control over the protocol and authentication mechanism.

```
clone:
 enabled: false
 
pipelines:
  default:
    - step:
      script:
        - echo "No code cloned!"
        - git clone git@bitbucket.org:WORKSPACE/REPO.git
        - <rest of your commands>
```

Since you're using Windows runners, that is executed directly in Powershell, the runner will use the SSH keys configured in the host machine. If you haven't already, [Setup the SSH keys in Windows](https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-windows/) , and once you confirm it's working through Powershell, it should work on Pipelines as well.

I hope that information helps!

Thank you, [@Valeriu Ghisoiu](/t5/user/viewprofilepage/user-id/5568129) !

Patrik S

comments: author: Valeriu Ghisoiu
body: Dear [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)

Thank you very much for your answer. This is without a doubt a really valuable answer.

The "clone: enabled: false" command that is huge!

On the other hand I found also another workaround, because my problem was related to the work inside the clone, not really the first clone itself (which worked), but the things were happening after, which they were using also https.

So to just not change the files in the repo (for the sake of others) I chose to change to ssh only for that pipeline session/build like this:  

\`\`\`  
script:  
- echo "Updating requirements.txt to use SSH instead of HTTPS."  
- (Get-Content requirements.txt) -replace '<https://bitbucket.org/>', 'ssh://git@bitbucket.org/' \| Set-Content requirements.txt  
- git remote set-url origin ssh://git@bitbucket.org/\<[domain\>/\<repo.git\>](https://bitbucket.org/)  
- git remote -v

\`\`\`

I have 2 more questions, they might be related to another topic but I make advantage of your answer. Please let me know if I open another topic for these:

<br />

**1.** With respect to "clone" command that you mentioned, I realise that are many commands for ci/cd which I don't really know them. **THERE is any Documentation related to the commands and description of those? Can you share a link?**

**2.** There is any documentation/link where I can find all the upgrades for the RUNNERS? I just saw Windows Runner 3.1.0 has been released. It was a jump from 2.6.0. So as a "rule" this means a big patch released, or important changes or adds. **Can you please share a link to release notes for windows runners also?**

Best,

Valeriu


author: Patrik S
body: Hey [@Valeriu Ghisoiu](/t5/user/viewprofilepage/user-id/5568129) ,

You're very welcome! Thanks for sharing your own workaround as well :)

As for your last two questions, let me address them individually for better clarity:
> **1.** With respect to "clone" command that you mentioned, I realise that are many commands for ci/cd which I don't really know them.**THERE is any Documentation related to the commands and description of those? Can you share a link?**

Definitely! You can use the [Bitbucket Pipelines configuration reference](https://support.atlassian.com/bitbucket-cloud/docs/bitbucket-pipelines-configuration-reference/) for a full list of commands available in Pipelines and their syntax in the YAML file.

> **2.** There is any documentation/link where I can find all the upgrades for the RUNNERS? I just saw Windows Runner 3.1.0 has been released. It was a jump from 2.6.0. So as a "rule" this means a big patch released, or important changes or adds.**Can you please share a link to release notes for windows runners also?**

Since runner v2.0, our engineering team has started to publish the changelogs of major and minor changes on [Bitbucket Runners Changelog](https://product-downloads.atlassian.com/software/bitbucket/pipelines/CHANGELOG.md). You can use that page to understand what changes were introduced in the recent releases of the runner.

Thank you, [@Valeriu Ghisoiu](/t5/user/viewprofilepage/user-id/5568129) !

Patrik S


author: Valeriu Ghisoiu
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ,

Thank you for your answers.

With your help I just did find the "Step Options Web Page", that was what I needed. Of course I don't see all the option cases, as an example the one that you suggested is missing. And it might be even more that are not deep explained:   
**clone :**

**enabled: false** (it is not existing)  
As a feedback, maybe Atlassian team could improve these pages in the future.

<br />

Also Thanks for the Runners Changelog. That I will save it for later, valuable page.  

Best regards,

Valeriu


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

docker

windows