Skip to content

[BUG] Lockfile does not retain the correct clone URL for GitHub Enterprise custom domains #325

@ianprime0509

Description

@ianprime0509

Describe the bug

When adding an APM dependency using an SSH clone URL for a GitHub Enterprise custom domain, e.g. git@github.example.com:org/repo.git, it is saved in apm.lock.yaml in the following format:

- repo_url: org/repo
  host: github.example.com
  # ...

Subsequently, running apm install ignores the host and attempts to clone from github.com/org/repo, which fails.

This can be worked around once by manually editing apm.lock.yaml to set repo_url: git@github.example.com:org/repo.git, allowing apm install to succeed, but it immediately overwrites apm.lock.yaml to the prior incorrect format after doing so.

To Reproduce

Steps to reproduce the behavior:

  1. Run apm install git@github.example.com:org/repo.git
  2. Attempt to run apm install again.
  3. The command fails, because it attempts to resolve the wrong URL (using github.com) for the repository.

Expected behavior

APM should maintain the original repository URL git@github.example.com:org/repo.git exactly as given, both in apm.yml and apm.lock.yaml, so that subsequent clones use the same URL.

Environment (please complete the following information):

  • OS: macOS
  • Python Version: 3.14.3
  • APM Version: 0.8.0 (af190ac) (installed via Homebrew)
  • VSCode Version (if relevant): N/A

Logs

After the initial dependency is added using git@github.example.com:org/repo.git:

$ apm install
Installing dependencies from apm.yml...
Installing APM dependencies (1)...
Using apm.lock.yaml (1 locked dependencies)


Installed 0 APM dependencies
No MCP dependencies found in apm.yml


── Diagnostics ──
  ✗ 1 package failed:
    └─ org/repo — Failed to install org/repo: Could not resolve commit '774e379945d8f6712a7c3047fa1f8815a7d8508d' in repository org/repo: Failed to clone
repository org/repo using all available methods. For private repositories, set GITHUB_APM_PAT or GITHUB_TOKEN environment variable, or ensure SSH keys are configured. Last error: 
Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v -- https://github.com/org/repo /var/folders/0c/t2hcl_tn2319_zwpyv_hb5dc0000gp/T/tmp3vc8l7w3
  stderr: 'Cloning into '/var/folders/0c/t2hcl_tn2319_zwpyv_hb5dc0000gp/T/tmp3vc8l7w3'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
'

Additional context

None.

Metadata

Metadata

Labels

acceptedDirection approved, safe to start workbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions