Repository navigation
Description
What would you like to see?
Add a protocol switch for each configured remote in Repository Settings so a user can convert a remote URL from HTTPS to SSH or from SSH to HTTPS without rewriting it manually. Show the generated URL before saving.
Problem it solves
Changing authentication methods currently requires knowing the provider-specific URL syntax and editing the remote by hand. This is error-prone for nested namespaces, self-hosted providers, non-default ports, and repositories with a separate push URL.
Feasibility
High. Commit+ already lists and edits remotes, resolves GitHub/GitLab/Bitbucket remote identities, and exposes GitStatusService.setRemoteURL. The missing work is safe URL conversion, preview/confirmation, and refresh behavior.
Proposed scope
- Show the current transport and a “Switch to SSH” or “Switch to HTTPS” action for the selected remote.
- Convert only when the host, owner path, and repository name can be preserved losslessly. Unsupported or ambiguous URLs should stay editable manually.
- Support GitHub, GitLab, Bitbucket, and standard self-hosted HTTPS/SSH forms; preserve nested groups,
.git, usernames, and explicit ports where possible. - Update the fetch URL with
git remote set-url. Detect a distinct push URL and never replace it silently; let the user explicitly include it. - Re-evaluate the preferred provider account/SSH key after conversion and refresh the visible remote state.
- Do not run fetch or push as part of the conversion.
Acceptance criteria
- Converting
https://github.com/org/repo.gitproducesgit@github.com:org/repo.git, and converting back restores the same repository identity. - GitLab nested groups and Bitbucket workspace paths round-trip correctly.
- A custom push URL is preserved unless the user explicitly chooses to convert it.
- Invalid or lossy conversions are blocked with a useful explanation.
- Unit tests cover provider URLs, scp-style SSH,
ssh://, ports, nested paths, and separate push URLs.
Implementation notes
The existing remote UI is in RepositorySettingsSheetView, URL identity parsing is in GitRemoteIdentityResolver, and mutation is already centralized in GitStatusService+Remote.swift. Keep conversion logic in a testable service rather than in the SwiftUI view.
Git reference: https://git-scm.com/docs/git-remote
Area
Settings / Preferences
Activity