I got a requirement to backup Azure Devops Repos to either Azure Blob or Sharepoint Libraries. I have created a pipeline using this approach. But my pipeline fails in the first step itself while copying Repo to Working Directory. Error : 400 error : "fatal: unable to access {Repo Name}"
- task: CmdLine@2
inputs:
script: 'git clone --mirror https://{Your PAT}@dev.azure.com/{OrgName}/{ProjectName}/_git/{RepoName}'
The PAT I am using is having full access. I also tried Powershell approach but it also gives same error. Powershell :
$MyPat = 'Access Token'
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$MyPat"))
git -c http.extraHeader="Authorization: Basic $B64Pat" clone "https://dev.azure.com/<Org>/<Project>/_git/<Repo>"
Any help or guidance regarding this is very much appreciated.
As zainul replied, space in the url should be replaced by '%20' if there are whitespaces in OrgName
or ProjectName
.