Skip to content

Fix repository recognition for SSH mapped configurations - #554

Merged
skarim merged 2 commits into
github:mainfrom
williammartin:williammartin-vhs-demo-ssh-alias
Oct 9, 2026
Merged

skarim merged 2 commits into
github:mainfrom
williammartin:williammartin-vhs-demo-ssh-alias

Conversation

@williammartin

@williammartin williammartin commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #45 and Fixes #337

Description

gh stack submit fails when the origin remote uses a custom SSH host alias. For example, git@github.com-work:org/repo where ~/.ssh/config maps github.com-work to github.com.

gh-stack uses repository.Current() from go-gh to work out which repo it is in. That function does expand SSH aliases with ssh -G. However, it then filtered remotes on the host from before the expansion. So github.com-work never matched a known host, and every command needing a GitHub client failed with:

✗ failed to create GitHub client: determining repository: unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host

This was fixed in cli/go-gh#274 and released in go-gh v2.16.2. This PR bumps the dependency.

How did you test this change?

I built two binaries from the same commit. The only difference was the go-gh version.

I then ran both against a private repo with an origin of git@github.com-work:williammartin/gh-stack-ssh-alias-demo.git. Each run used an isolated SSH config where github.com-work resolved to github.com.

The two runs used the same terminal, commands, and repo state. Each one had a two-branch stack (layer-1 and layer-2) on top of main. I ran gh stack submit --auto in each.

Before (go-gh v2.16.1), I saw the error above:

Terminal running gh stack submit --auto with go-gh v2.16.1 against a github.com-work SSH alias remote and failing to determine the current repository

After (go-gh at the commit tagged v2.16.2), I saw two draft PRs and a stack created:

Terminal running gh stack submit --auto with the go-gh fix against the same remote, creating PR 1 and PR 2 and a stack with 2 PRs

The after recording shows the replace => v2.16.2-0.20261009094949-aadf36735579 because I recorded it before the tag existed. The v2.16.2 tag points at that same commit, aadf367.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly.
  • An agent will draft replies and @williammartin will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@williammartin
williammartin requested a review from skarim as a code owner October 9, 2026 10:43
Copilot AI balanced review requested due to automatic review settings October 9, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The valid dependency release contains the intended SSH alias fix, and the module files are consistent.

0 open findings

What changed in this PR

Updates go-gh to fix repository detection for remotes using SSH host aliases.

Changes:

  • Bumps go-gh from v2.16.1 to v2.16.2.
  • Updates module checksums accordingly.
File Description
go.mod Updates the direct go-gh dependency.
go.sum Records matching v2.16.2 checksums.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@williammartin
williammartin marked this pull request as draft October 9, 2026 10:49
@williammartin williammartin changed the title Bump go-gh to v2.16.2 Fix repository recognition for SSH mapped configurations Oct 9, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@williammartin
williammartin force-pushed the williammartin-vhs-demo-ssh-alias branch from 02594ae to e22c782 Compare October 9, 2026 11:42
@williammartin
williammartin marked this pull request as ready for review October 9, 2026 11:42
@williammartin
williammartin requested a balanced review from Copilot October 9, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The dependency release contains the intended fix and the regression test exercises it directly; only the PR description needs a minor scope correction.

1 open finding

🧠 Review effort: Balanced

Comment thread internal/config/repo_test.go

@ktravers ktravers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Appreciate the test coverage, looks great 🚀

@skarim
skarim merged commit 29a36d3 into github:main Oct 9, 2026
4 checks passed
@williammartin
williammartin deleted the williammartin-vhs-demo-ssh-alias branch October 9, 2026 14:32
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.

Remapping hostname prevents using gh stack submit gh stack submit fails when remote uses a custom SSH host alias

4 participants