How to authenticate to Azure repositories and run Git commands in an Azure pipeline
When working with Azure Pipelines, you may encounter a situation where you don’t know the repository name before the pipeline runs. In such cases, using the checkout: git://MyProject/MyRepo
method won’t work, as variables can’t be used as values in that syntax.
You will get the following error from Git:
fatal: Cannot prompt because terminal prompts have been disabled.
fatal: could not read Password for 'https://[email protected]/...': terminal prompts disabled
To overcome this challenge, I came up with a solution: create a task at the beginning of your job definition that “authenticates” the pipeline against your Azure DevOps project.
Let’s see this in action.
Read the complete article