Skip to content

Enterprise (self-hosted) git providers: build clones from hardcoded gitlab.com/github.com/bitbucket.org #692

Description

@Yuyz0112

Summary

Projects::BuildJob#project_git builds the clone URL from a hardcoded host per provider type:

base_url = if provider.github?
  "github.com"
elsif provider.gitlab?
  "gitlab.com"
elsif provider.bitbucket?
  "bitbucket.org"
end

Enterprise (self-hosted) providers are supported elsewhere — Provider#enterprise?, #api_base_url and #source_base_url all honor registry_url, and Providers::CreateGitlabProvider validates the PAT against the self-hosted instance just fine. But the actual build then tries to clone from gitlab.com and fails:

fatal: Authentication failed for 'https://gitlab.com/<owner>/<repo>.git/'
Failed to clone repository: Command failed with exit code 128

Repro

  1. Create a GitLab provider with registry_url pointing at a self-hosted GitLab instance (PAT validates OK).
  2. Create a project from a repo on that instance and deploy.
  3. Build fails at clone with the error above.

Suggested fix

Use provider.source_base_url in project_git instead of the hardcoded hosts. For instances that are HTTP-only (common for internal GitLab), the scheme could be taken from registry_url rather than hardcoding https://.

We are running Canine self-hosted (BOOT_MODE=cluster, image ghcr.io/caninehq/canine:latest as of 2026-08-01) against a self-hosted GitLab and currently patch this via an initializer. Happy to send a PR if the source_base_url approach sounds right to you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions