github / github/gh-stack

`gh stack submit` fails when remote uses a custom SSH host alias

オープン
#45 コメント 4 件 リアクション 6 件 担当者 0 名 GitHub で見る
bug topic: cli - submit
主要言語
Go
スター
1.5k
フォーク
70
平均マージ
1日 8時間
マージ済み PR(30日)
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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。