GCode is a Python CLI that shells out to local tools, so the experience on Windows depends on which environment you run it in. This guide covers the three common options — native Windows, WSL2, and Git Bash — and documents what is known to work and what is not yet supported.
| Environment | Best for | Tool support |
|---|---|---|
| WSL2 (recommended) | Full experience: bash, git, grep | execute_bash, git tools, grep all work as on Linux |
| Native Windows | Quick tries, Python-only workflows | execute_bash uses cmd.exe (bash syntax fails), git tools need Git for Windows, grep falls back to pure Python |
| Git Bash | Users already on Git Bash | Mostly works, but see the limitations below |
- Python 3.10 or newer on
PATH - An OpenRouter API key (
OPENAI_API_KEYis also accepted as a fallback) gitonPATHfor the git tools (/status,/diff,git_commit)
WSL2 gives you a real Linux environment where GCode's bash tool and git tools behave exactly as documented.
- Install WSL2 and a distro (e.g. Ubuntu):
Reboot when prompted, then open the Ubuntu terminal.
wsl --install - Inside WSL, install Python 3.10+ and git:
sudo apt update && sudo apt install -y python3 python3-pip python3-venv git - Clone and install GCode:
git clone https://github.com/shauryagangrade/GCode.git cd GCode python3 -m pip install -e .
- Create the env file inside WSL and add your API key:
mkdir -p ~/.gcode cp .env.example ~/.gcode/.env
- Run it:
gcode
Your ~/.gcode directory lives inside the WSL filesystem. To use the same
API key from Windows and WSL you can copy %USERPROFILE%\.gcode\.env into
WSL (cp /mnt/c/Users/<you>/.gcode/.env ~/.gcode/.env), but keeping them
separate is simpler.
GCode runs as a normal Python program on Windows. The CLI, /models menu,
history, and the pure-Python grep fallback work; the execute_bash tool
has real limitations (see below).
- Install Python 3.10+ from python.org (check "Add python.exe to PATH" during install).
- Open a terminal (PowerShell or cmd) and install:
(Or
pip install -e .pip install -e .from the GCode checkout if you cloned it first.) - Create the env file. On Windows,
~is your user profile directory:That places it atmkdir $env:USERPROFILE\.gcode Copy-Item .env.example $env:USERPROFILE\.gcode\.env
C:\Users\<you>\.gcode\.env. - Edit it with your key and run
gcode.
execute_bash runs commands through Python's shell=True. On native
Windows that invokes cmd.exe, not bash, so bash syntax fails:
greppipelines,&&-chains of POSIX commands,export FOO=bar,$HOMEreferences, and single-quote quoting do not behave as on Linux.- Tools like
curlmay not exist on stock Windows (curl.exeis present on modern builds, but the classiccurlalias may route to PowerShell).
This is tracked in issue #54 (execute_bash and git tools assume POSIX/bash — broken on native Windows). Until it is fixed, prefer WSL2 or Git Bash for anything that shells out.
The git tools (/status, /diff, git_commit) call the git binary. On
native Windows you must install Git for Windows and
make sure git is on PATH (the installer offers this). Git Bash is
included with Git for Windows, so installing it covers both cases.
Git Bash (installed with Git for Windows) provides a POSIX-ish shell with
bash, git, and grep on PATH. GCode's execute_bash will find
bash via shell=True, so most commands behave as on Linux.
- Run
gcodefrom a Git Bash window, andexecute_bashcommands are interpreted by bash. - The pure-Python
grepfallback is not used because the MSYSgrepis onPATH; keep--includeglobs attached to the flag (the tool does this automatically) so MSYS does not glob-expand them. - Paths passed to tools should use the MSYS/Git Bash view (
/c/Users/<you>/...orC:/Users/<you>/...), notcmd-style paths.
GCode reads its API key from ~/.gcode/.env (not a project-root .env):
| Environment | Location |
|---|---|
| WSL2 / Linux | ~/.gcode/.env → /home/<you>/.gcode/.env |
| Native Windows | ~/.gcode/.env → C:\Users\<you>\.gcode\.env |
| Git Bash | ~/.gcode/.env → C:\Users\<you>\.gcode\.env (same as Windows) |
Optional user-wide settings live in ~/.gcode/.gcoderc (see the README
Configuration file section); a
project-local .gcoderc in the directory you launch GCode from overrides it.
Session history also persists under ~/.gcode/.
execute_bashon native Windows usescmd.exe, not bash — bash-only syntax fails (#54).- Git tools require a
gitbinary onPATH(Git for Windows / WSL). - The
greptool prefers a systemgrepwhen available and falls back to a pure-Python search otherwise, so it works everywhere, but performance on very large trees is better with the system binary. - Free OpenRouter models are heavily rate-limited on the shared tier; a
429response means "wait and retry" (see README Models section).
- Open an issue with the bug report template
and include your environment (native Windows / WSL2 / Git Bash, Python
version,
gcode --versionoutput). - If bash-style commands fail, note the exact command and whether you ran from PowerShell, cmd, or Git Bash — that tells us which shell the tool actually used.