`gh stack submit` fails when remote uses a custom SSH host alias
- 主要语言
- Go
- 星标
- 1.5k
- 派生
- 70
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 7
描述
`gh stack submit` exits with an error when the git remote URL uses a custom SSH host alias (e.g. `github.com-work`) instead of the literal `github.com` hostname. There is no flag to override the repository, so `submit` is unusable in this configuration.
## Steps to reproduce
1. Configure `~/.ssh/config` with a host alias (common for multi-account setups):
```
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
```
2. Clone using the alias:
```
git clone git@github.com-work:org/repo.git
cd repo
```
`git remote get-url origin` → `git@github.com-work:org/repo.git`
3. Initialize a stack and submit:
```
git checkout -b layer-1 && git commit --allow-empty -m "layer 1"
git checkout -b layer-2 && git commit --allow-empty -m "layer 2"
git checkout layer-1
gh stack init --adopt -b main layer-1 layer-2
gh stack submit --draft
```
## Actual result
```
✗ 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
```
The `--remote origin` flag and `GH_HOST=github.com` env var do not help — the error
is identical with both.
## Expected result
`gh stack submit` pushes the branches and opens draft PRs, the same as it would with a `git@github.com:org/repo.git` remote.
## What I tried
- `gh stack submit --remote origin` — same error
- `GH_HOST=github.com gh stack submit` — same error
- `GH_REPO=org/repo gh stack submit` — gets past host detection, but then pushes to
`git@github.com:org/repo.git` instead of the configured alias, so the push fails
with a key-agent rejection
## Workaround
Push branches manually and create PRs one at a time:
```bash
git push origin layer-1 layer-2
gh pr create --draft --repo org/repo --base main --head layer-1 --title "layer 1"
gh pr create --draft --repo org/repo --base layer-1 --head layer-2 --title "layer 2"
```
## Environment
```
gh version 2.89.0 (nixpkgs)
gh extension: gh stack (github/gh-stack)
OS: macOS
Remote URL format: git@github.com-:org/repo.git
```
贡献指南
调研方向
从 gh stack submit 的仓库检测和 push 路径开始,使用文档中所述的 github.com-work SSH 别名以及 --remote origin 和 GH_HOST 情况重现该故障。完成的标准是 submit 能识别仓库,并在打开草稿 PR 之前通过已配置的别名进行 push,与 github.com 的字面行为一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, github, go
- 领域
- cli, devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 58/100