When we use GitPython in Azure DevOps and try to push to a repository, the following message occurs (same repository as cloned by the pipeline):
stderr: 'git: 'credential-manager-core' is not a git command. See 'git --help'.
Infrastructure: GitHub, Windows build machine (latest)
Since our working-directory is the currently cloned repository, we initialize the repository like this:
import git
repo = git.Repo('.')
# Do some stuff
repo.git.execute('git add --all -- ":!build-infrastructure"')
repo.git.execute(f'git commit -m "{generic_commit_message}"')
repo.git.execute('git push')
So pushing the changes should work with the same credentials, as Azure DevOps used for pulling. Am I missing something?
SOLUTION
The solution is to override the checkout
step in the pipeline: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#checkout
steps:
- checkout: self
submodules: true
persistCredentials: true
SOLUTION
The solution is to override the checkout step in the pipeline: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#checkout
steps:
- checkout: self
submodules: true
persistCredentials: true