Using Azure Pipelines, I am trying to do "git clone --mirror" on a self-hosted Windows agent.
It works if I use bash on a MS-hosted agent. But my self-hosted agent doesn't have bash right now, so I want to use script instead:
script: 'git clone --mirror https://dev.azure.com/MyCompany/Project%20Name/_git/MyRepo'
But I get this error:
remote: TF200016: The following project does not exist: Project0Name. Verify that the name of the project is correct and that the project exists on the specified Azure DevOps Server. fatal: repository 'https://dev.azure.com/MyCompany/Project0Name/_git/MyRepo/' not found
In the error message, the URL-encoded space in the project name has been replaced with a '0'. So it cannot find the repo since the URL is now wrong.
This error appears with both the MS-hosted agent and my self-hosted agent.
The issue seems to be the same as here: Cannot clone git repository in command line script task in Azure DevOps Pipelines
Why does the URL get changed in this way? How can I work around it?