Repository navigation
Description
Summary
With machine Git credentials enabled, Git operations on an enrolled non-primary machine lose local credential helpers for non-GitHub repositories. The forwarded GitHub helper works, but a private GitLab HTTPS fetch fails even though the machine has a working GitLab helper.
Versions and environment
- bb 0.50.1, npm server install; Linux primary server and enrolled macOS worktree host.
- Git 2.55.0. Reproduced on the enrolled host; the primary host does not receive the injected Git config.
- The same config entries are present on upstream main at a89f5d7, lines 12–15. I did not run a bb build from main.
Steps to reproduce
- Enable machine Git credentials and sign in to GitHub on the bb server. Enroll a second machine.
- On that machine, configure a working helper for a private GitLab HTTPS repository.
- In a bb worktree thread on the enrolled machine, run
GIT_TERMINAL_PROMPT=0 git ls-remote <private-gitlab-https-url> HEAD. - In the same thread, repeat with
env -u GIT_CONFIG_COUNT GIT_TERMINAL_PROMPT=0 git ls-remote <private-gitlab-https-url> HEAD. This is a diagnostic control, not a fix.
Expected vs actual
Expected: GitHub uses the forwarded helper and GitLab can still use the machine's helper. Actual: GitHub succeeds, GitLab exits 128 with fatal: could not read Username. The diagnostic control succeeds for GitLab.
Evidence and proposed patch
In githubGitConfiguration, use credential.https://github.com.helper for both helper keys. Keep the empty reset first and the forwarded helper second. Do not change either GitHub SSH-to-HTTPS rewrite.
The investigation report is the self-contained fixture below. Save it as repro.sh and run sh repro.sh. It uses command-scope config (like bb), synthetic credentials, and no network.
#!/bin/sh
set -eu
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
cd "$scratch"
chmod 700 "$scratch"
cat > gitconfig <<'EOF'
[credential "https://gitlab.example"]
helper = "!f() { printf 'username=local-gitlab\\npassword=synthetic\\n'; }; f"
[credential "https://github.com"]
helper = "!f() { printf 'username=local-github\\npassword=synthetic\\n'; }; f"
EOF
forwarded='!f() { if grep -qx host=github.com; then printf "username=forwarded-github\npassword=synthetic\n"; fi; }; f'
probe() {
scope=$1 host=$2
result=$(printf 'protocol=https\nhost=%s\n\n' "$host" |
env -i PATH="$PATH" HOME="$scratch" GIT_CONFIG_NOSYSTEM=1 \
GIT_CONFIG_GLOBAL="$scratch/gitconfig" GIT_TERMINAL_PROMPT=0 \
git -c "$scope=" -c "$scope=$forwarded" credential fill 2>&1) || {
printf '%s | %s | %s\n' "$scope" "$host" "$result"
return
}
printf '%s | %s | %s\n' "$scope" "$host" "$(printf '%s\n' "$result" | grep '^username=')"
}
probe credential.helper gitlab.example
probe credential.https://github.com.helper gitlab.example
probe credential.https://github.com.helper github.comObserved with Git 2.55.0:
credential.helper | gitlab.example | fatal: could not read Username for 'https://gitlab.example': terminal prompts disabled
credential.https://github.com.helper | gitlab.example | username=local-gitlab
credential.https://github.com.helper | github.com | username=forwarded-github
A one-shot test with the two proposed keys also succeeded against real GitLab and GitHub HTTPS remotes on the enrolled machine. No persistent config was changed.
What you ruled out
- The GitLab helper works when the injected config is absent, so this is not an expired GitLab login.
- Server gh login is never forwarded to machines when the server has no primary host #5133 concerns forwarding never reaching a machine; here forwarding works and clears unrelated helpers.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 23, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotworkspaces,host.confirmed-repro.Scope the forwarded GitHub credential helper to github.com (get-bb#8055)