2

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?

1 Answer 1

4

I found the answer in the link above. The '%' character needs to be escaped like so:

script: 'git clone --mirror "https://dev.azure.com/MyCompany/Project%%20Name/_git/MyRepo"'

Also, I added double quotes, not sure if that makes a difference though.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.