Reputation: 443
In my Azure DevOps CD pipeline, I have added a Command Line task which clones a Git repository. The clone is done successfully however there is an error in the log.
The strange behavior is that the clone works perfectly with an Azure hosted agent (like vs2017-win2016 or windows-2019) but generates the error (see below screenshot) if I use a private local agent.
Command Line Script:
git config --global user.email "[email protected]"
git config --global user.name "naregk"
git clone -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" https://naregk.visualstudio.com/txproject/_git/RepoD testrepoD
The stage outcome:
The error which appears:
57.7114907Z ##[command]"C:\Nindows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\agent_work_temp\aae38ede—905d—4d6d-9412-0 57.96819332 ##[error]Cloning into 'testrepoD'... 06.96751142 ##[section]Finishing: Command Line Script
Upvotes: 2
Views: 1098
Reputation: 41775
Some git command output can be stderr
(instead of stdout
) and PowerShell think it's an error.
To solve it, you can do something like this:
$result = git clone -c ....... testrepoD 2>&1
Write-Host $result
Upvotes: 2