Skip to content

gh uses the https git protocol where the contract prescribes ssh, and no script checks it #672

Closed

Description

@ptr727

docs/host-setup.md prescribes gh auth login --hostname github.com --git-protocol ssh. On the maintainer's Windows host, gh auth status reports:

github.com
  ✓ Logged in to github.com account ptr727 (keyring)
  - Git operations protocol: https
  - Token scopes: 'gist', 'read:org', 'repo', 'workflow'

That host is otherwise fully set up: key present, commits signing and verifying locally, gh at 2.97.0, and scripts/host_gate.py exits 0 over all seven declared tools. So this is drift on a host that passes every check the fleet currently runs.

The consequence is quiet rather than loud. gh repo clone and gh pr checkout set an https remote, so a checkout made through gh authenticates by token where every other checkout on that host authenticates by key. Revoking the host's SSH key would not cut that checkout's access, which is the opposite of what the key-based setup is for.

Neither host-setup/linux/setup-github.sh nor the new host-setup/windows/setup-github.ps1 looks at gh at all, so the drift is invisible to both. The new Windows script does report it, as one line in its status output:

GitHub CLI
  [ ok ] authenticated as ptr727
  [    ] git protocol is ssh, it is https, set it with: gh config set git_protocol ssh

The narrow fix is that same reported line in the Linux script too, so both platforms surface it and neither writes it.

The wider question, worth settling rather than assuming: should --configure set it, or stay a reported gap? Rewriting a working authentication configuration is arguably the operator's call, which is why the Windows script reports and does not act. The Linux script currently touches gh nowhere, and the two should agree either way.

Activity

  1. ptr727 commented on Aug 21, 2026

    @ptr727
    OwnerAuthor

    Current audit against develop at 1832702: partial. host-setup/windows/setup-github.ps1 reports a GitHub CLI protocol other than SSH and gives the gh config set git_protocol ssh remedy. The Linux setup script and shared host gate still do not check this setting, and no configure behavior settles the wider question.

  2. added
    decision
    on Sep 5, 2026
  3. ptr727 commented on Sep 8, 2026

    @ptr727
    OwnerAuthor

    Maintainer's answer, 2026-09-08, given when this issue was presented as part of the parked-decision queue at handoff.

    Report on both platforms by default, and configure only behind an explicit opt-in flag.

    That settles the wider question this issue raised. Rewriting a working authentication configuration stays something the operator asks for rather than something --configure does on its own, which is the behaviour host-setup/windows/setup-github.ps1 already has, and the Linux script gains the same reported line so the two agree. The opt-in flag is the addition to both.

    The cost he accepted, stated plainly: one more flag to carry on both platforms, against the alternative of either silently rewriting a working config or leaving the drift to a human noticing a status line.

    The decision label comes off, since the direction is settled and what remains is implementation. The issue stays open for that work.

  4. removed
    decision
    on Sep 8, 2026
  5. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Claimed for the wsl lane (#2478), worked on this WSL2 Debian host.

    • Branch: feature/wsl-672
    • Predicted file set: host-setup/linux/setup-github.sh, host-setup/windows/setup-github.ps1, docs/host-setup.md, and any test file for either script

    Any other group needing one of these files waits for this branch to merge.

  6. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Question for the maintainer from the wsl lane worker on #2595, which implements the recorded decision above.

    The branch ran three recorded local review passes and two rounds of edits answered them. The third pass raised one finding on text this change wrote. The two-round budget sends it here rather than into a third round of edits.

    • Finding: gh_account (Linux) and Get-GhAccount (Windows) take the first Logged in to github.com account X line of gh auth status --hostname github.com. Take a host with two github.com accounts where the active account's token is broken. Its line reads Failed to log in, and the second account's line reads Logged in. The report then shows [ ok ] authenticated as the second account while gh runs as the broken one, and the opt-in's logged-in check passes on it.
    • Counts: 1 introduced, 0 style, 0 pre-existing open.
    • Proposed fix: gh auth status --active --hostname github.com, which lists only the active account (present in gh 2.97 and 2.102), on both scripts, with a test of the two-account case.

    Should this fix go into #2595 as a third round, or merge as is with the fix filed as its own issue?

  7. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer, 2026-10-08, to the question above: fix it in #2595. One more round is allowed there: both scripts read the active account through gh auth status --active --hostname github.com, with a test for the two-account case. Then #2595 runs its review loop to the develop merge.

  8. added 2 commits that reference this issue on Oct 8, 2026
    d8d6198
    6427783
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions