Skip to content

SSH URL conversion removes non-standard ports when converting to HTTPS #259

Description

@Danie1Nash

Description

The current implementation of VCS.replace_ssh_url() preserves SSH ports when converting SSH URLs to HTTPS. This causes issues when using non-standard SSH ports (e.g., 8022), as the converted HTTPS URL will contain the SSH port, which typically doesn't work for HTTPS connections.

Current Behavior

from clearml_agent.helper.repo import VCS

url = "ssh://gitlab.example.com:8022/user/repo.git"
result = VCS.replace_ssh_url(url)
print(result)
# Output: https://gitlab.example.com:8022/user/repo.git

The resulting HTTPS URL contains port 8022, which is the SSH port, not the HTTPS port. This will likely fail when attempting to clone the repository via HTTPS.

Expected Behavior

When converting SSH URLs to HTTPS, non-standard ports should be removed, as HTTPS typically uses the standard port 443 (or a different port configured on the server):

url = "ssh://gitlab.example.com:8022/user/repo.git"
result = VCS.replace_ssh_url(url)
print(result)
# Expected: https://gitlab.example.com/user/repo.git

Questions

  1. Is this the expected/desired behavior? Should SSH ports be preserved when converting to HTTPS, or should they be removed as proposed?
  2. Would you be interested in a PR for this fix? I have:
    • Working implementation that passes all existing tests
    • Additional test cases covering non-standard ports
    • No breaking changes to existing functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions