Skip to content

fix(git): handle SSH remote URLs with explicit ports#286

Merged
sachiniyer merged 1 commit intomainfrom
siyer/fix-ssh-port-parsing
May 9, 2026
Merged

fix(git): handle SSH remote URLs with explicit ports#286
sachiniyer merged 1 commit intomainfrom
siyer/fix-ssh-port-parsing

Conversation

@sachiniyer
Copy link
Copy Markdown
Contributor

Summary

  • parse_github_remote_url rejected valid SSH remotes with explicit ports (e.g. ssh://git@github.com:22/owner/repo.git) because the prefix list only matched ssh://git@github.com/, breaking repo auto-inference for users with that remote format.
  • Added a strip_ssh_port normalization helper (mirroring the existing strip_http_credentials pattern) that drops :PORT from the SSH authority before prefix matching, so the URL falls through to the existing path.
  • Added 5 tests covering port :22, a non-default port, port + no .git suffix, port + trailing slash, and rejection of ports on non-GitHub hosts.

Closes #272.

Test plan

  • cargo test --lib utils::git — 25 passed (5 new, 20 existing)
  • cargo test — full suite green
  • cargo fmt --check
  • cargo clippy --lib

🤖 Generated with Claude Code

Repo auto-inference returned None for valid SSH URLs that include an
explicit port in the authority (e.g. ssh://git@github.com:22/owner/repo.git)
because strict prefix matching only accepted ssh://git@github.com/. Add a
strip_ssh_port normalization step that mirrors the existing HTTP-credentials
normalization, so SSH URLs with ports fall through to the existing prefix
match. Closes #272.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sachiniyer sachiniyer temporarily deployed to integration-tests May 9, 2026 03:03 — with GitHub Actions Inactive
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@sachiniyer sachiniyer merged commit 88ef9fb into main May 9, 2026
13 checks passed
@sachiniyer sachiniyer deleted the siyer/fix-ssh-port-parsing branch May 9, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] CLI: Repo auto-inference fails for GitHub SSH remotes with explicit ports

1 participant