Skip to content

[BUG] apm install https tries to access via ssh #992

Description

@mf-gdi

Describe the bug
Running apm install https://<repo-url>.git --update with a private Git repository URL fails during validation because APM appears to resolve the repository via SSH and tries to connect to port 22, even though the dependency is configured in a non-SSH form and the package can later be resolved from apm.yml if added manually. The errors even persists when i use the "--https"-flag.

To Reproduce
Steps to reproduce the behavior:

  1. Run command:
    apm install https://bitbucket.example.internal/scm/team/example-repo.git --update --verbose
    
  2. See error during validation: connection attempt to SSH port 22 times out and the package is reported as not accessible
  3. Create an apm.yml with a private Bitbucket dependency in this form:
    name: project
    version: 1.0.0
    description: APM project for project
    author: anonymized
    dependencies:
      apm:
        - bitbucket.example.internal/scm/team/example-repo
      mcp: []
    scripts: {}
  4. Run command:
    apm install --update --verbose
    
  5. See that the dependency is resolved from apm.yml / lock data and installed.

Expected behavior
APM should consistently resolve and validate the repository using the provided repository format. If an HTTPS repository URL is passed, it should not fall back to SSH validation on port 22 unless explicitly configured to do so. Policy retrieval should either authenticate correctly, fail clearly with actionable guidance, or honor a configured access method without proceeding silently.

Environment (please complete the following information):

  • OS: Windows
  • APM Version: 0.9.4
  • VSCode Version (if relevant): N/A

Logs

> apm install https://bitbucket.example.internal/scm/team/example-repo.git --update --verbose
[*] Validating 1 package...
  Trying git ls-remote for bitbucket.example.internal
  git ls-remote rc=128: ssh: connect to host bitbucket.example.internal port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[x] https://bitbucket.example.internal/scm/team/example-repo.git -- not accessible or doesn't exist
All packages failed validation. Nothing to install.
> apm install --update --verbose
[>] Installing dependencies from apm.yml...
Parsed apm.yml: 1 APM deps, 0 MCP deps
Loaded apm.lock.yaml for SHA comparison
Resolved dependency tree successfully

[!] Could not fetch org policy from org:bitbuckettest.example.internal/scm/.github
(Refusing HTTP redirect (302) from
https://bitbuckettest.example.internal/api/v3/repos/scm/.github/contents/apm-policy.yml
to
https://bitbuckettest.example.internal/login?...);
proceeding without policy enforcement.

[+] example-repo @<sha> (cached)
[+] common-dependency @<sha> (cached)

[*] Installed 2 APM dependencies.

Additional context
The same dependency appears to work when installed indirectly from apm.yml and cache/lock resolution, but fails when the repository URL is passed directly on the command line. This suggests inconsistent repository resolution or protocol handling between direct package validation and dependency installation. The policy fetch behavior (302) may be a separate issue, but it also indicates that there are unexpected(?) requests to our server.

Metadata

Metadata

Labels

area/cliCLI command surface, flags, help text (cross-cutting).priority/highShips in current or next milestonestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).type/bugSomething does not work as documented.

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions