Skip to content

fix: force Pkg to use system git on Windows for ct-registry/git-deps - #67

Merged
ocots merged 2 commits into
mainfrom
fix/windows-pkg-cli-git
Jul 30, 2026
Merged

fix: force Pkg to use system git on Windows for ct-registry/git-deps#67
ocots merged 2 commits into
mainfrom
fix/windows-pkg-cli-git

Conversation

@ocots

@ocots ocots commented Jul 30, 2026

Copy link
Copy Markdown
Member

Why

Seen on windows-latest in control-toolbox/OptimalControl.jl#826, job 90833796963:

Error: Some registries failed to update:
    — .julia\registries\ct-registry — failed to fetch from repo: failed to fetch from
      git@github.com:control-toolbox/ct-registry.git, error: GitError(Code:EUSER,
      Class:Callback, Aborting, user cancelled credential request.)
...
ERROR: LoadError: failed to clone from git@github.com:control-toolbox/CTLie.jl.git,
error: GitError(Code:EUSER, Class:Callback, Aborting, user cancelled credential request.)

The step-by-step job log shows exactly where this splits:

  • "Add ct-registry" succeeds — it starts its own ssh-agent.exe and talks to it via system git/ssh, which is why the existing "Prefer Git's OpenSSH client (Windows)" fix (PR Fix Windows ct-registry: OpenSSH client + cache ordering #66) works for it.
  • "Build Julia package" failsPkg.instantiate/Pkg.build re-fetches the registry and clones any git-sourced dependency (here CTLie) through Julia's own bundled LibGit2, not system git. The stacktrace confirms it (LibGit2.CachedCredentials, LibGit2.clone). On Windows, LibGit2's libssh2 can't talk to the ssh-agent the same way system git can (agent transport mismatch), so it falls back to an interactive credential prompt that can never be answered in CI.

Same root cause as #66, one layer deeper: that PR fixed the tool (add-julia-registry's own ssh-agent/ssh-keyscan invocation), this one fixes Pkg itself.

Fix

Set JULIA_PKG_USE_CLI_GIT=true on Windows (right after Add ct-registry sets up the working agent) so Pkg shells out to system git for its own registry/dependency git operations too, instead of using the bundled LibGit2.

Test plan

  • Re-run OptimalControl.jl#826's CI pointing at this branch (uses: control-toolbox/CTActions/.github/workflows/ci.yml@fix/windows-pkg-cli-git) and confirm the Windows CPU job goes green
  • Point back to @main once merged

🤖 Generated with Claude Code

ocots and others added 2 commits July 30, 2026 11:48
The ssh-agent set up for `Add ct-registry` is only reachable by system
git/ssh — that step already succeeds because of it. But Pkg's own git
operations after that (re-fetching the registry during instantiate, and
cloning any git-sourced dependency such as CTLie) go through Julia's
bundled LibGit2 instead, which can't use that same agent on Windows (its
named-pipe transport isn't something libssh2 understands there) and
fails with "user cancelled credential request".

Set JULIA_PKG_USE_CLI_GIT=true on Windows so those operations shell out
to the system git that already has working SSH access, instead of
LibGit2.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Confirmed on OptimalControl.jl#826 job 90836999549: the previous fix
(setting JULIA_PKG_USE_CLI_GIT=true via GITHUB_ENV) had no effect.
julia-actions/julia-buildpkg@v1's own script unconditionally runs
`ENV["JULIA_PKG_USE_CLI_GIT"] = <git_cli input, default false>` before
Pkg.Registry.add()/Pkg.build(), clobbering whatever was exported before
the step ran. The action does expose a `git_cli` input for exactly this
case ("might be necessary for more complicated SSH setups") — pass it
instead of fighting the action's own default.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ocots
ocots merged commit d5a5467 into main Jul 30, 2026
@ocots
ocots deleted the fix/windows-pkg-cli-git branch July 30, 2026 10:10
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.

1 participant