Skip to content

blueprints create: resolve SSH host aliases in the origin remote - #76

Open
Mohith26 wants to merge 1 commit into
render-oss:mainfrom
Mohith26:fix/blueprint-ssh-host-alias
Open

Mohith26 wants to merge 1 commit into
render-oss:mainfrom
Mohith26:fix/blueprint-ssh-host-alias

Conversation

@Mohith26

@Mohith26 Mohith26 commented Nov 3, 2026

Copy link
Copy Markdown

Summary

render ea blueprints create infers the repository from the origin remote when --repo is omitted. If that remote uses an SSH host alias from ~/.ssh/config, which is the usual setup for people with more than one GitHub account, the inferred URL uses the alias as the host:

origin: git@github-work:acme/app.git
repo:   https://github-work/acme/app.git   (on main)

This change resolves the alias with ssh -G <host> (it prints the effective config without connecting) for SSH remotes whose host isn't already github.com, gitlab.com or bitbucket.org. If the resolved HostName is one of the providers' SSH-over-443 hosts (ssh.github.com, altssh.gitlab.com, altssh.bitbucket.org), it maps back to the main host. If ssh isn't available or fails, the remote is used unchanged, so behavior only changes for aliases that resolve. Explicit --repo values are not touched, and hosts starting with - are never passed to ssh.

Motivation

I hit this reading the new repo/branch inference in pkg/blueprint/git.go; no existing issue.

How to verify

  • go test ./pkg/blueprint/ -run TestBuildCreateRequestResolvesSSHHostAlias -v: new table test covering an scp-style alias, an ssh:// alias with a port, an alias for ssh.github.com, a known provider host (not passed to ssh), an unresolvable host, and an HTTPS origin. sshHostname is a variable so the test doesn't depend on the machine's ssh config.
  • On main, the same buildCreateRequest call with origin git@github-work:acme/app.git returns https://github-work/acme/app.git.
  • Checked the real sshHostname by hand: git.example.com resolves to itself, and -oProxyCommand=x is rejected before calling ssh.
  • go test ./cmd/... ./pkg/... ./internal/... passes; go vet and gofmt are clean. I didn't have golangci-lint locally.

Release notes

- `render ea blueprints create` now resolves SSH host aliases from `~/.ssh/config` when inferring the repository from the `origin` remote.

When the origin remote uses a ~/.ssh/config alias, such as
git@github-work:acme/app.git for a second GitHub account, the inferred
repository became https://github-work/acme/app.git. Resolve the alias
with `ssh -G` (which reads ssh config without connecting) for SSH remotes
whose host isn't a known provider host, and map GitHub, GitLab and
Bitbucket SSH-over-443 hosts back to their main host.
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.

1 participant