Skip to content

Scope the forwarded GitHub credential helper to github.com - #8055

Merged
ymichael merged 1 commit into
get-bb:mainfrom
lanjak:fix-8048-scoped-credential-helper
Nov 24, 2026
Merged

ymichael merged 1 commit into
get-bb:mainfrom
lanjak:fix-8048-scoped-credential-helper

Conversation

@lanjak

@lanjak lanjak commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

With machine Git credentials on, githubGitConfiguration (apps/server/src/services/machines/git-credentials.ts) sends command-scope Git config that resets the unscoped credential.helper list and then adds the forwarded helper. The reset applies to every URL. On an enrolled machine it clears the local helpers for GitLab, Bitbucket and all other hosts. The forwarded helper answers only https://github.com, so HTTPS operations against other hosts have no helper and fail with fatal: could not read Username. See #8048 and the investigation report.

What changed

  • apps/server/src/services/machines/git-credentials.ts: both helper entries use credential.https://github.com.helper, the empty reset first and the forwarded helper second. Git applies a URL-scoped helper key only to URLs that match it, and it reads command-scope config last. Thus the reset still clears every local helper for github.com, so forwarding still wins there, and the helpers for other hosts stay active. This is the fix that the issue proposes.
  • The two SSH-to-HTTPS rewrites for github.com do not change.
  • No daemon change and no HOST_DAEMON_PROTOCOL_VERSION bump. The server sends the same env entry names and the same shape (GIT_CONFIG_COUNT stays 4). Only two string values change. The daemon passes the entries to child processes and does not read them, so a daemon that has not updated applies the new values correctly.
  • Side effect: plain http://github.com and github.com subdomains (for example gist.github.com) now use the machine's own helpers. Before, they had no helper.

How you verified

  • The issue's repro.sh with git 2.56.1 gives the same output as the report: the unscoped key clears the GitLab helper, and the scoped key keeps it while github.com gets the forwarded helper.
  • New test in git-credentials.test.ts. It writes a gitconfig with helpers for gitlab.example, github.com and all hosts, then runs real git credential fill with the env that resolveGitCredentials returns. Before the fix it fails (expected 128 to be +0 for gitlab.example). After the fix it passes: gitlab.example and bitbucket.example use their local helpers, github.com gets the forwarded token, and no local helper runs for github.com.
  • pnpm exec turbo run typecheck lint:type-aware test --filter=@bb/server: pass (4455 tests).

Fixes #8048

AGENT GENERATED

Reset and set credential.https://github.com.helper instead of the
unscoped credential.helper, so local helpers for other hosts stay
active.
@ymichael
ymichael merged commit 651ae20 into get-bb:main Nov 24, 2026
29 checks passed
@lanjak
lanjak deleted the fix-8048-scoped-credential-helper branch November 24, 2026 21:24
alexburlis added a commit to alexburlis/omnyo that referenced this pull request Nov 26, 2026
Record the upstream PRs, revisions, contributors, and Omnyo integration
commits for merge d2a24ac in docs/upstream-credits.md.

Original-PR: get-bb/bb#7663
Original-Commit: get-bb/bb@1737a03
Original-Author: rufi
Original-PR: get-bb/bb#8055
Original-Commit: get-bb/bb@651ae20
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8075
Original-Commit: get-bb/bb@511e1ed
Original-Author: Jake Lancaster
Original-Co-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8096
Original-Commit: get-bb/bb@775090b
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8145
Original-Commit: get-bb/bb@8de6711
Original-Commit: get-bb/bb@0d3db49
Original-Commit: get-bb/bb@92d3a76
Original-Commit: get-bb/bb@6705422
Original-Author: Michael Yong
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8171
Original-Commit: get-bb/bb@b56ed04
Original-Author: Jake Lancaster
Original-PR: get-bb/bb#8238
Original-Commit: get-bb/bb@2a9a142
Original-Author: SawyerHood
Original-PR: get-bb/bb#8247
Original-Commit: get-bb/bb@ba4ae22
Original-Author: Salem
Original-Co-Author: Claude Opus 5.5
Original-PR: get-bb/bb#8259
Original-Commit: get-bb/bb@96f40a9
Original-Author: SawyerHood
Original-PR: get-bb/bb#8263
Original-Commit: get-bb/bb@141e40a
Original-Author: mk
Original-PR: get-bb/bb#8266
Original-Commit: get-bb/bb@84e20e9
Original-Author: ILIA GOLUBEV
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.

Machine GitHub credential forwarding clears local GitLab HTTPS helpers

2 participants