I am trying to execute git commands through PowerShell task in an Azure DevOps Server and I am facing authentication issues. More specific the task keep exiting with error code 1, as it asks for username and password. The git commands I am trying to executre are:
$wikiUrl = 'https://azure-devops-server/tfs/Common/MainProject/_git/MainProject.wiki'
git clone $wikiUrl $tmpDirName --depth 1
# Editing files content
git -C $tmpDirName add $statusPageRepoPath
git -C $tmpDirName commit -m 'update status page'
git -C $tmpDirName push
I don't want to add the username and the password as parameters for security reasons. I am interested in making it work with the user credential being retrieved from the execution and not explicitly defined.
The recommended from Microsoft solution is to enable in the Agent the option to allow scripts to access the OAuth token. I have enabled this option as it is shown in the picture below, but still, I am getting the same error.
It looks like that the git clone command cannot access the token and it keeps asking for credentials. I tested also the git checkout and it looks to work ok. The problem is mainly appears to be with the clone command.

