Aident AI

If Codex Desktop says Git is unavailable for a repository in WSL but Git works in the WSL terminal, do not delete the repository or rebuild its .git directory. First prove the repository is healthy. Then run Codex CLI inside WSL as the safe fallback while the Desktop regression is unresolved.
This distinction matters because the current failure can happen before Codex Desktop finishes detecting the repository. Repairing healthy Git data will not fix a broken Windows-to-WSL handoff, and it can turn a recoverable app problem into real data loss.
Confirm You Have the WSL Desktop Regression
The clearest current report involves Codex Desktop on Windows with a repository stored on the WSL ext4 filesystem, such as /home/you/code/project. Affected builds classify a valid repository as non-Git and log an error like this:
The report first identified Microsoft Store package 26.721.3404.0 with app server 0.146.0-alpha.3. Other users reproduced the failure after updating, including on the later 26.721.4979.0 package. Check About Codex and compare your version with the open upstream issue before assuming the same cause.
This guide fits when all of these are true:
Codex Desktop is running on Windows with the agent environment set to WSL.
The project lives at a Linux path such as
/home/you/code/project.Desktop says
Git is unavailable, hides the branch, or treats the folder as a non-Git project.Git commands still succeed from a WSL shell.
If Git also fails in the WSL shell, fix that repository or Git installation first. That is a different problem.
Step 1: Verify Git Inside WSL
Open a WSL terminal and change to the exact repository that Codex Desktop rejects:
Expected results:
git --versionprints an installed Git version.git rev-parse --show-toplevelprints the repository root under/home/....git rev-parse --is-inside-work-treeprintstrue.git statusprints the branch and any real local changes.git fsck --connectivity-onlycompletes without a fatal connectivity error.
If these checks pass, Git can read the repository and its object graph. Save the output with the Codex build number if you plan to add a useful reproduction to the upstream issue.
Step 2: Preserve Local Work Before Troubleshooting
Record what is not committed:
Copy any critical uncommitted files to a separate location before trying app updates or project reassociation. Do not:
delete
.git;wipe
%USERPROFILE%\.codex;repeatedly add the same Linux path as a new project;
edit or bypass the packaged Desktop Git worker;
downgrade an app package from an untrusted source.
Reports on the current regression show that reinstalling the app, clearing Codex state, and recreating project entries may leave the failure unchanged. Those actions add risk without addressing the suspected cross-environment precheck.
Step 3: Use Codex CLI Entirely Inside WSL
OpenAI's current WSL documentation recommends running Codex inside the Linux environment and keeping repositories under the Linux home directory. If Codex CLI is not installed in your WSL distribution, run the official installer from the WSL shell:
Confirm the binary and start it from the repository:
The expected result is that Codex CLI opens with the WSL repository as its working directory and normal Git commands remain available. In the active upstream report, the CLI continued to recognize the same repositories that Desktop marked as non-Git.
This is a workaround for continuing work, not a claim that the Desktop bug is repaired.
Why the WSL CLI Workaround Helps
The evidence points to a Windows/WSL path mismatch in the Desktop Git worker's availability check. That check can fail before later repository detection runs, so Desktop returns Git is unavailable even though git status and git rev-parse work inside WSL.
Codex CLI launched from WSL stays inside the Linux environment. Its executable, working directory, Git binary, and repository path all use Linux semantics. That removes the failing Windows-to-WSL Desktop boundary from the immediate workflow.
This explanation is an inference from the public reproduction and isolation results. OpenAI has not yet documented a final root cause or universal Desktop fix.
Step 4: Retest Desktop After an Official Update
When a newer Codex Desktop build is available:
Read the latest status on issue #35119.
Update Codex Desktop through its official distribution channel.
Fully quit and reopen the app.
Open the existing project entry once. Do not create duplicates first.
Confirm that the branch appears and native worktree creation is available.
Recheck the Desktop logs for the exact
Git is unavailablesignature.
Keep using the WSL CLI if Desktop still fails while the terminal checks remain healthy.
Common Failure Modes
git: command not found
Git is not installed or is not on PATH inside that WSL distribution. Install Git through the distribution's package manager, reopen the shell, and rerun git --version before diagnosing Codex.
The repository is under /mnt/c
OpenAI recommends keeping WSL repositories under ~/code/... for faster I/O and fewer symlink and permission problems. Clone or copy the repository safely to the Linux filesystem, verify the new copy, and only then switch your working location.
WSL is version 1
Current Codex uses bubblewrap for its Linux sandbox and no longer supports WSL1. From PowerShell, check the distribution version:
Use WSL2 before continuing with the Linux-native path.
which codex prints nothing
The CLI installer did not add Codex to the current shell's PATH. Open a new WSL shell and rerun which codex. Follow the installer's printed path guidance rather than installing an unrelated package with the same name.
Git works in WSL but only Desktop fails
That is the strongest signal for the current Desktop handoff regression. Preserve the repository, use the WSL CLI, and attach your Codex version plus read-only Git checks to the upstream report.
Keep External Credentials Out of the Repository
Once the coding workflow is stable, avoid putting GitHub, issue-tracker, or SaaS tokens in .env files that an agent can read. Aident Loadout gives Codex a searchable tool catalog with managed authentication instead.
After setup, use one read-only search as the measurable recovery check:
For the credential boundary behind that pattern, see How to Give AI Agents API Access Without Exposing Keys. For a separate native Windows sandbox problem, use How to Fix Codex Windows Sandbox Errors Safely.
Conclusion
When Codex Desktop reports Git is unavailable but WSL Git checks pass, treat the repository as healthy until evidence says otherwise. Preserve local work, run Codex CLI inside WSL, and wait for a verified Desktop update instead of deleting Git data or patching the app bundle.


