[PR #9323] fix(cli): support SSH aliases when installing opencode GitHub app #13075

Open
opened 2026-02-16 18:17:57 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9323

State: open
Merged: No


What does this PR do?

Fixes https://github.com/anomalyco/opencode/issues/9317.

The fix consists of running ssh -G alias to resolve the alias and find the hostname configured in the .ssh/config file. If said hostname is github.com, then proceed with the installation. Otherwise, raise the existing error.

Fix description

  1. Run git remote get-url origin .
    a. If the output contains github.com as a hostname, install the app.
    b. If not, continue with the alias resolution.
  2. Run ssh -G alias to resolve the alias.
  3. Extract the hostname from the output of ssh -G alias.
  4. Verify the hostname is github.com.
    a. If it matches, proceed with the installation.
    b. If it doesn't match, raise the existing error.

The existing behaviour remains if no alias is used.

Fix screenshot

Screenshot from 2026-01-18 21-12-04

How did you verify your code works?

Manual verification by running bun dev github install on a repo. Also, added unit tests to ensure the behavior is as expected.

How to verify the fix?

Set up a ssh alias as described in https://github.com/anomalyco/opencode/issues/9317. Then, clone a repo using the alias. Finally, run opencode github install in said repo.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9323 **State:** open **Merged:** No --- ### What does this PR do? Fixes https://github.com/anomalyco/opencode/issues/9317. The fix consists of running `ssh -G alias` to resolve the alias and find the hostname configured in the .ssh/config file. If said hostname is `github.com`, then proceed with the installation. Otherwise, raise the existing error. ### Fix description 1. Run `git remote get-url origin` . a. If the output contains `github.com` as a hostname, install the app. b. If not, continue with the alias resolution. 3. Run `ssh -G alias` to resolve the alias. 4. Extract the hostname from the output of `ssh -G alias`. 5. Verify the hostname is `github.com`. a. If it matches, proceed with the installation. b. If it doesn't match, raise the existing error. **The existing behaviour remains if no alias is used.** ### Fix screenshot <img width="1257" height="699" alt="Screenshot from 2026-01-18 21-12-04" src="https://github.com/user-attachments/assets/3d010e2c-30ae-4db6-9661-c4298acba8e9" /> ### How did you verify your code works? Manual verification by running `bun dev github install` on a repo. Also, added unit tests to ensure the behavior is as expected. ### How to verify the fix? Set up a ssh alias as described in https://github.com/anomalyco/opencode/issues/9317. Then, clone a repo using the alias. Finally, run `opencode github install` in said repo.
yindo added the pull-request label 2026-02-16 18:17:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13075