Codex Says Git Is Unavailable in WSL? Recover Safely

Codex Says Git Is Unavailable in WSL? Recover Safely

Aident AI

A cyan Git path meets a coral fault at a dark boundary and reroutes through an amber Linux-native path.

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:

worker_rpc_response_error errorMessage="Git is unavailable" method=turn-diff-capture-start workerId=git

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:

cd ~/code/your-project
git --version
git rev-parse --show-toplevel
git rev-parse --is-inside-work-tree
git status --short --branch
git fsck --connectivity-only

Expected results:

  • git --version prints an installed Git version.

  • git rev-parse --show-toplevel prints the repository root under /home/....

  • git rev-parse --is-inside-work-tree prints true.

  • git status prints the branch and any real local changes.

  • git fsck --connectivity-only completes 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:

git status --short --branch
git diff --stat
git diff --cached --stat

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:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Confirm the binary and start it from the repository:

which codex
cd ~/code/your-project
codex

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:

  1. Read the latest status on issue #35119.

  2. Update Codex Desktop through its official distribution channel.

  3. Fully quit and reopen the app.

  4. Open the existing project entry once. Do not create duplicates first.

  5. Confirm that the branch appears and native worktree creation is available.

  6. Recheck the Desktop logs for the exact Git is unavailable signature.

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:

wsl -l -v

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:

aident capabilities search --query "GitHub pull request status"

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.

Sources

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.