FJ-39: authenticate AGit https push with the stored keys.json token #48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "david/feat/agit-keys-token-FJ-39"
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?
Implements FJ-39. Depends on FJ-38 (TLS), which shipped in v0.8.0.
Problem
fjkeeps two transports: the REST API client (built from the keys.json token) and the libgit2 git transport used only by the AGit path. The AGit fetch/push authenticated solely throughauth-git2(ssh-agent, ssh keys, credential helpers), which never reads keys.json or~/.netrc. Sofj pr create -aAover https failed with "all authentication attempts failed" on a host where none of those were configured, even though fj was fully authenticated for that host's API. This blocked the claude-run native YouTrack finalize, which callsfj pr create -aA.Change
crates/fj/src/prs.rs:PrCommand::runresolves the host's stored(username, token)viaKeyInfo::get_login(afterget_api, so any OAuth refresh is reflected) and threads it intocreate_pr. The AGit fetch/push credential callbacks now offer that token as HTTP basic auth forhttps://remotes via a newagit_credentialswrapper, falling back toauth-git2for ssh remotes, unknown hosts, or when no token is stored.msg-pr-create-agit_token_auth, en-US + de-DE) names the host when the stored token is used, so the credential source is transparent. Consent is the existingfj auth add-keygrant; no prompt is introduced, so the path works headless.~/.netrcparsing added.Verification
This PR was opened with the fixed local binary via
fj pr create --agitover the https remote, with no credential helper, no ssh key applicable to https, and~/.netrc(which libgit2 ignores) present. The push authenticated purely with the keys.json token, exercising acceptance criteria 1 and 2 end to end. Unit tests cover the offer-once / fallback / non-plaintext-skip semantics.#FJ-39