auth setup-git installs broken credential helper — sed eats the appended verb #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
fj auth setup-git(v0.1.0, fromrasterandstate/tap) installs a git credential helper that fails on every invocation because git appends the verb (get,store,erase) to the end of the command line, andsedtreats it as a filename.Repro
On a fresh machine:
Result:
Root cause
The installed helper is literally:
Git appends the verb to the helper command, so it actually runs:
getis now a positional arg tosed, which interprets it as a filename and bails. The broken pipe panic comes fromfjflushing stdout after sed has already died.Fix
Wrap the helper so the verb lands as
$1and gets ignored (or matched againstget):This is what
fj auth setup-gitshould install per host.Also worth checking
On macOS,
git-credential-osxkeychaincan intercept the request before any host-specific helper runs if there's a stale credential for the host.fj auth setup-gitcould clear any existing osxkeychain entry for the host as part of setup:Environment
/opt/homebrew/opt/git)Fixed in
b68fb98onmain.Root cause was as diagnosed: git appends
"$@"inside the helper'ssh -ccommand line, sed gobbles the verb as a filename, the credential dance fails. New helper wraps the pipeline in a shell function so the trailing arg is swallowed byfinstead of leaking to sed.Recovery on an already-broken machine:
This overwrites the broken
credential.https://<host>.helpergit config value with the new function-wrapped form.Regression tests added in
src/cli/auth.rs::setup_git_tests:credential_helper_wraps_in_shell_function— structural invariantscredential_helper_isolates_git_verb— verb-trailing simulation for get/store/eraseManual verification, replicating git's actual invocation:
Will land in v0.1.1 along with the Homebrew formula bump.