One push, thirty failures. The blockade was neither the network nor the token's scope — it was a forgotten identity mapping inside the Windows Credential Manager. This is how we found it. Every conclusion comes from an instrumented observation; none from a guess.
Background: a 403 that looked increasingly like a network problem
The task was ordinary: push a local commit of the DevLog site repository to GitHub Pages. The remote is a fixed public repository, the token comes from an environment variable, and the same script had succeeded before. This time, the push failed repeatedly.
Failures came in two alternating forms, logged one by one: connection timeouts — Failed to connect to github.com:443 after 21089 ms — and connection resets — Recv failure: Connection was reset. Of thirty retries, fifteen ended in command timeout (exit 124) and fifteen in connection-layer failure (exit 128); within the latter, ten were roughly twenty-one-second connect timeouts and five were resets.
That distribution is deeply misleading: it looks like network jitter. Had we stopped there, the obvious conclusion would have been "unstable network, keep retrying." We refused it — because the same machine over the same link had pushed to the same repository successfully minutes earlier.
Step one: separate the network from the network
Instead of blind retries, we ran a controlled comparison: probing the read and write endpoints of the Git smart protocol separately. The read endpoint (upload-pack) returned a steady 200; the write endpoint (receive-pack) returned 401 without credentials. TCP and TLS were therefore healthy — the 401 was simply the normal "unauthenticated" answer.
We then tested direct and proxied paths: the local proxy port was listening, and both paths worked at the probe level. The decisive distinction: the network layer was fine; the fault came after the authentication exchange. With an authorization header attached, the direct path reset while the proxied path returned a fast, stable 403 in about a second. A fast, stable 403 is the most valuable evidence in the whole chain: the server received the request and deliberately rejected the identity.
Step two: interrogate the credential store with system tools
Since an identity was rejected, we had to find out which identity was actually used. We invoked the Windows credential enumeration utility and read every stored entry. This had to be done through a pathway that renders Unicode and full entries correctly — running it in a plain shell produced only a usage block due to encoding, which means it had effectively found nothing.
The enumeration surfaced two key records, targeting the ordinary GitHub endpoint and one prefixed with x-access-token, with user names SinoSir and x-access-token respectively. Two GitHub credential sets coexisted on the machine — what we later called the ghost credential: it throws no error, prints no warning, and is silently selected under a particular username-matching rule.
To see which set was in use, we asked the credential subsystem to fill credentials explicitly, masking the secret field in output. Without a specified username it returned SinoSir; with x-access-token explicitly requested, the returned secret was still the same fine-grained token. Both entries resolved to a single identity.
Step three: root cause — an identity-mapping mismatch
We then ran four push comparisons, changing exactly one variable each: native credential manager, environment token with x-access-token as username, a username-embedded URL, and the real account name as username. The first three all returned the same server message: remote: Permission to ... denied to SinoSir.
That sentence was decisive: we believed we were presenting the new token identity, while the server insisted we were the old account SinoSir. The root cause was locked in — a mismatch between the username field and the credential-entry matching rule. The generic placeholder x-access-token matched the stale entry, so the usable fine-grained token was never sent. The 403 did not mean "no permission"; it meant "wrong identity."
This is also why an earlier assumption had to be corrected: declaring "the token lacks permission" from a single 403 does not hold. The metadata API reported push permission on the target repository, and organization and repository state were normal. Instrumented fact overrode impression — that is part of the discipline.
The fix: one combination, plus a rigorous loop
The working combination has three parts, none optional:
- Set the real account name explicitly as the credential username instead of the generic placeholder, so the subsystem stops matching the ghost entry;
- Read the token only from an environment variable — never in a URL, config, or log, always masked as
[REDACTED]in output; - Keep the working proxy and handshake parameters — reuse the system proxy configuration and a stable TLS backend / HTTP version pair, and stop clearing the proxy by hand.
Before touching the main branch, we pushed a temporary probe branch end to end. Once the probe succeeded, we confirmed the server had accepted the new objects, deleted the probe branch, verified no residue remained, and only then pushed the main branch. This "probe — verify — clean — publish" loop keeps experimentation out of the release history.
After the main push, the remote ref advanced from its old value. The Pages build moved from building to built, all six public addresses returned 200, and every key element was verified present on the live pages.
Closing
In complex troubleshooting, compute can run thirty retries but cannot ask the question "is the identity mapping wrong?" Carbon intuition supplies the suspicion; silicon verification supplies the proof. What makes the conclusion stand is the refusal to treat one 403 as the end — the patience to seek truth from facts all the way down.
| Record | Value (instrumented) |
|---|---|
| Total retries | 30 |
| Timeout exits (code 124) | 15 |
| Connection failures (code 128) | 15 |
| ~21s connect timeout / reset | 10 / 5 |
| Server rejection line | denied to SinoSir |
| Token leakage | zero (all [REDACTED]) |