Uh oh!
There was an error while loading. Please reload this page.
Use API SSH URLs for repository clones - #14346
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 635c0b51-d384-47de-bca4-121793a65152
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the reported failure and comprehensively tests affected clone paths.
Review tier: Balanced
Findings: None
What changed in this PR
Uses API-provided SSH URLs so repository clones preserve organization-specific SSH routing.
Changes:
- Uses
sshUrlfor SSH clones, wikis, and fork upstreams. - Adds missing-URL validation and regression coverage.
| File | Description |
|---|---|
pkg/cmd/repo/clone/clone.go | Selects authoritative SSH URLs. |
pkg/cmd/repo/clone/clone_test.go | Tests SSH CA, wiki, upstream, and error cases. |
api/queries_repo.go | Requests sshUrl. |
api/queries_repo_test.go | Verifies SSH URL decoding. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee65cc7a-8eaf-4f12-8c00-a94930274a0e
williammartin
marked this pull request as ready for review
September 4, 2026 13:39
This was referenced Sep 4, 2026
Merged
MartinodF
commented
Sep 4, 2026
Tested it on our tenant, works perfectly 🙏 |
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#14344
Description
gh repo clonereconstructs SSH remote URLs from the repository host, owner, and name. That drops the organization routing username GitHub includes when an organization has a usable SSH certificate authority, causing certificate authentication to fail on GHE.com.This change requests the repository's authoritative
sshUrland uses it for SSH clones, SSH wiki clones, and fork upstream remotes. HTTPS cloning continues to use the existing URL formatter.How did you test this change?
I configured an organization-scoped SSH certificate authority on
test-prodweu01.ghe.comand ran the same clone command againstwilliammartin-ssh-testing/ssh-testwith the installedghand a binary built from this branch. The installed version failed public-key authentication; the changed version cloned successfully.Before
After
Key points
The API owns SSH routing semantics, so this does not try to reconstruct organization-specific usernames in the client. It returns an explicit error if an SSH clone response unexpectedly omits
sshUrl. No feature detection is needed becauseRepository.sshUrlis supported across the GitHub products supported bygh.Notes for reviewers
Start with
remoteURLinpkg/cmd/repo/clone/clone.go, then review theGitHubRepofragment and regression cases. Issue #14344 contains the original GHE.com failure.Authorship and follow-up
Who wrote this:
Who answers review comments: