creating a stack from a self hosted Azure DevOps git repository fails with error: git repository: failed to clone git repository: unexpected client error: unexpected requesting "URL/_git/REPO/git-upload-pack" status code: 400
Expected Behavior
stack should be created
Actual Behavior
fails to create stack with error: git repository: failed to clone git repository: unexpected client error: unexpected requesting "URL/_git/REPO/git-upload-pack" status code: 400
The underlying issue seems to be that go-git didn't support multi_ack and has been discussed here: https://github.com/portainer/portainer/issues/1926 which resulted in a workaround that downloads the repository as a zip-file instead of using git clone.
If I understand the code correctly it just checks the domain part of the URL to detect if it is an Azure DevOps repository or not:
While this works fine for the cloud version it fails to detect self hosted Azure DevOps repositories and tries to use git clone instead.
Now an easy fix would probably be something like a "Is Azure DevOps repository" checkbox in the Add Stack GUI to force the zip download instead of git clone or an additional setting to add custom Azure DevOps domains.
It also seems that the underlying issue in go-git has been partially fixed by now: https://github.com/go-git/go-git/issues/64 so maybe that would also be an option.
Before you start please confirm the following.
Problem Description
creating a stack from a self hosted Azure DevOps git repository fails with error:
git repository: failed to clone git repository: unexpected client error: unexpected requesting "URL/_git/REPO/git-upload-pack" status code: 400
Expected Behavior
stack should be created
Actual Behavior
fails to create stack with error:
git repository: failed to clone git repository: unexpected client error: unexpected requesting "URL/_git/REPO/git-upload-pack" status code: 400
Steps to Reproduce
Portainer logs or screenshots
No response
Portainer version
2.19.4
Portainer Edition
Community Edition (CE)
Platform and Version
Docker 24.0.7
OS and Architecture
AlmaLinux 9.2
Browser
No response
What command did you use to deploy Portainer?
No response
Additional Information
The same issue has already been submitted here: https://github.com/portainer/portainer/issues/8732 but couldn't be reproduced because not a self hosted Azure DevOps was used for testing.
The underlying issue seems to be that go-git didn't support multi_ack and has been discussed here: https://github.com/portainer/portainer/issues/1926 which resulted in a workaround that downloads the repository as a zip-file instead of using git clone. If I understand the code correctly it just checks the domain part of the URL to detect if it is an Azure DevOps repository or not:
https://github.com/portainer/portainer/blob/develop/api/git/azure.go
While this works fine for the cloud version it fails to detect self hosted Azure DevOps repositories and tries to use git clone instead.
Now an easy fix would probably be something like a "Is Azure DevOps repository" checkbox in the Add Stack GUI to force the zip download instead of git clone or an additional setting to add custom Azure DevOps domains. It also seems that the underlying issue in go-git has been partially fixed by now: https://github.com/go-git/go-git/issues/64 so maybe that would also be an option.