Describe the bug
Adding dependencies with a non "git" username with ssh approach fails when running apm install.
Suspected culprit:
From the logs attached at the bottom it shows that it uses git as the username when cloning instead of the provided username in the dependency.
I found this looking through the code (src/apm_cli/utils/github_host.py):
def build_ssh_url(host: str, repo_ref: str, port: int | None = None) -> str:
"""Build an SSH clone URL for the given host and repo_ref (owner/repo).
When ``port`` is set, emit the explicit ``ssh://`` form because SCP
shorthand (``git@host:path``) cannot carry a port — the ``:`` is the path
separator. Without a port, keep the compact SCP shorthand (no behavioural
change for the common case).
"""
if port:
return f"ssh://git@{host}:{port}/{repo_ref}.git"
return f"git@{host}:{repo_ref}.git"
To Reproduce
Steps to reproduce the behavior:
- Add apm dependency using ssh and a different username than "git".
- Run apm install
dependencies:
apm:
- git: <user>@<host>:<org>/<repo>
path: <path-to-skill>
ref: <some-commit>
Expected behavior
Correct username is used to clone the repo, thus, the dependency is correctly installed.
Environment (please complete the following information):
- OS: Windows
- Python Version: 3.13.3
- APM Version: 0.14.0
Logs
$ apm install
[>] Installing dependencies from apm.yml...
[i] Targets: copilot (source: apm.yml)
[x] 2 packages failed:
+- <org>/<repo>/.github/skills/<skill-name> -- Failed to install
<host>/<org>/<repo>/.github/skills/<skill-name>: Failed to clone repository: Failed to
clone repository <org>/<repo> via SSH. To allow cross-protocol fallback (not recommended), pass
--allow-protocol-fallback or set APM_ALLOW_PROTOCOL_FALLBACK=1. Please check repository access permissions and
authentication setup. Last error: Command '['C:\\Program Files\\Git\\mingw64\\bin\\git.EXE', 'clone', '--bare',
'git@<host>:<org>/<repo>.git',
'C:\\Users\\<local-user>\\AppData\\Local\\Temp\\apm_shared_<org>_<repo>_izozilg5\\bare']' returned non-zero exit
status 128.
+- <org>/<repo>/.github/skills/<skill-name> --
<org>/<repo>/.github/skills/<skill-name>: integration failed
[x] Failed to install APM dependencies: One or more direct dependencies failed validation. Run with --verbose for details.
[i] Run with --verbose for detailed diagnostics
[!] Install interrupted after 9.6s.
Describe the bug
Adding dependencies with a non "git" username with ssh approach fails when running apm install.
Suspected culprit:
From the logs attached at the bottom it shows that it uses git as the username when cloning instead of the provided username in the dependency.
I found this looking through the code (src/apm_cli/utils/github_host.py):
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Correct username is used to clone the repo, thus, the dependency is correctly installed.
Environment (please complete the following information):
Logs