GitOps Source ignores explicit http:// scheme and forces HTTPS, causing "server gave HTTP response to HTTPS client"
Before you start please confirm the following.
- Yes, I've searched similar issues on GitHub.
- Yes, I've checked whether this issue is covered in the Portainer documentation.
Problem Description
When creating or testing a GitOps Source with a Repository URL explicitly set to http://, Portainer internally sends the request over HTTPS instead, causing the connection to fail with a scheme mismatch error.
Environment:
- A self-hosted Git server (e.g. GitLab) running in a Docker container, reachable internally only via plain HTTP (e.g.
http://git-server:8080). - TLS/SSL is terminated externally by a reverse proxy (e.g. Nginx), not by the Git server itself.
- Portainer, the Git server, and the reverse proxy all run on the same Docker network.
Confirmed via manual testing:
- A direct
curl http://git-server:8080/...from a container on the same Docker network returns a valid HTTP response (401 Unauthorizeddue to auth, as expected — no scheme-related error). - This confirms the target server correctly serves plain HTTP, and the issue is isolated to Portainer's internal git client forcing HTTPS regardless of the URL's configured scheme.
- The Skip TLS verification toggle has no effect on the outcome, which is expected since this error occurs before certificate validation would apply.
Additional context:
A similar report exists in a related Portainer tool (portainer-mcp), where the client also appears to force HTTPS regardless of the URL's specified scheme, suggesting a shared underlying issue in URL/scheme handling across Portainer's tooling: https://github.com/portainer/portainer-mcp/issues/36
Expected Behavior
Portainer should connect to the Git repository using plain HTTP, exactly as specified in the http:// scheme entered in the Repository URL field.
Actual Behavior
Portainer attempts to connect over HTTPS instead, and the connection fails with:
Get "https://git-server:8080/group/project.git/info/refs?service=git-upload-pack": http: server gave HTTP response to HTTPS client
Note that the error message itself shows https://, even though the configured Repository URL field clearly shows http://.
Steps to Reproduce
- Set up a self-hosted Git server (e.g. GitLab) reachable internally only via plain HTTP, for example
http://git-server:8080. TLS/SSL is terminated externally by a reverse proxy (e.g. Nginx), not by the Git server itself. - Ensure Portainer, the Git server, and the reverse proxy all run on the same Docker network.
- In Portainer, go to Sources > Add Git Source.
- Set Repository URL to: http://git-server:8080/group/project
- Enable Authentication, and provide a valid Username and Personal Access Token.
- (Optional) Enable Skip TLS verification.
- Click Test Connection.
- Observe the error, which shows
https://in the request URL even though the Repository URL field was explicitly set tohttp://. - To confirm the Git server itself is not at fault, run a direct test from a container on the same Docker network:
docker run --rm --network curlimages/curl -v "http://git-server:8080/group/project.git/info/refs?service=git-upload-pack"
This returns a valid HTTP response (e.g. 401 Unauthorized due to auth), confirming the server correctly serves plain HTTP and the scheme-forcing issue is isolated to Portainer's Git client.
Portainer logs or screenshots
No response
Portainer version
2.45.0
Portainer Edition
Community Edition (CE)
Platform and Version
Docker
OS and Architecture
Ubuntu 22.04
Browser
No response
What command did you use to deploy Portainer?
Additional Information
No response
Source: portainer/portainer