This guide sets up Claude Code (the CLI tool by Anthropic) with the GSD (Get S**t Done) workflow extension.
Claude Code supports two authentication methods — choose the one that applies to you:
| Method | Who it's for | What you need |
|---|---|---|
| Anthropic API key | Pay-as-you-go via Anthropic Console | An API key from console.anthropic.com |
| Claude subscription | Claude Pro or Max subscribers | A claude.ai account with an active subscription |
The installation steps for Node.js, Git Bash, Claude Code, and GSD are the same for both. Only Step 2 differs.
Install the following before starting:
Node.js v20 LTS or newer — https://nodejs.org/en/download
node --version and npm --versionGit for Windows (Git Bash) — https://git-scm.com/downloads/win
Authentication — choose one:
Option A — Anthropic API key (pay-as-you-go):
sk-ant-api03-...Option B — Claude Pro or Max subscription:
Open Git Bash and run:
npm install -g @anthropic-ai/claude-code
Verify the install:
claude --version
If you get an error like "native binary not installed", run:
node "$(npm root -g)/@anthropic-ai/claude-code/install.cjs"
=== "Option A — Anthropic API Key"
Claude Code reads the API key from the `ANTHROPIC_API_KEY` environment variable.
The right place to set it on Windows (using Git Bash) is your `~/.bashrc` file.
Open or create `~/.bashrc` in a text editor, or run this command (replace the key with yours):
```bash
echo 'export ANTHROPIC_API_KEY="sk-ant-api03-YOUR-KEY-HERE"' >> ~/.bashrc
```
Then reload it:
```bash
source ~/.bashrc
```
Verify it worked:
```bash
echo $ANTHROPIC_API_KEY
```
You should see your key printed. If you see nothing, see Troubleshooting below.
=== "Option B — Claude Subscription (Pro / Max)"
No environment variable is needed. Claude Code handles authentication via browser login.
Run `claude` from Git Bash for the first time:
```bash
claude
```
Claude Code will display a login method selection screen. Choose **"Claude account with subscription"** (or **"Login with claude.ai"**).
A browser window will open — log in with your claude.ai account credentials. After authorizing, return to Git Bash.
Claude Code saves your session credentials automatically. You will not be prompted again on subsequent runs.
!!! tip
If the browser doesn't open automatically, copy the URL shown in the terminal and paste it into your browser manually.
GSD adds a powerful project management workflow on top of Claude Code (planning phases, commit guards, status line, etc.).
Install GSD fork (recommended):
```bash
npm install -g github:open-gsd/gsd-core
```
If you used Option A (API key): verify your key is still loaded in this Git Bash session before continuing:
echo $ANTHROPIC_API_KEY
You should see your key printed. If you see nothing, run source ~/.bashrc and try again.
If it still prints nothing, see the Troubleshooting section below before continuing.
If you used Option B (subscription): skip the key check — you're already authenticated.
Then initialize GSD hooks in Claude Code by opening Claude Code and running:
/gsd-update
!!! warning "Option A only — getting a login prompt on first run?"
On first run, Claude Code may show a login method selection screen even when ANTHROPIC_API_KEY is already set.
Do not choose "Claude account with subscription". Instead, select "Anthropic Console account" — that is the API key path.
Claude Code will detect your ANTHROPIC_API_KEY environment variable automatically and save the credentials.
You will not be prompted again after this.
If your API key is not visible (`echo $ANTHROPIC_API_KEY` prints nothing), the variable is not loaded.
See the **Troubleshooting** section below — specifically Causes 1 and 2.
This installs the GSD hooks into ~/.claude/hooks/ and updates ~/.claude/settings.json automatically.
Open a new Git Bash window, navigate to a project folder, and start Claude:
cd /c/Users/YourName/source/repos/YourProject
claude
.bashrc change is loaded. You should land directly at the Claude Code prompt.If a GSD status line appears at the bottom, setup is complete.
To reduce permission prompts when working in a repo, create a .claude/settings.local.json inside the project folder. You can copy the permission list from another user's setup or start fresh — Claude will prompt you during a session and offer to save new permissions.
If you're currently using an Anthropic API key (pay-per-token) and want to switch to a Claude Pro or Max subscription (flat monthly cost), follow these steps.
!!! warning "The API key must be removed"
Claude Code checks for ANTHROPIC_API_KEY first. If the variable is still set in your shell, it will continue using the API key even after you log in with a subscription. You must remove or disable the variable before switching.
Go to https://claude.ai and subscribe to Pro or Max using the same account you want to use for Claude Code. Confirm the subscription is active before continuing.
Open ~/.bashrc in a text editor and find the line that sets your API key:
export ANTHROPIC_API_KEY="sk-ant-api03-..."
Either delete the line entirely, or comment it out by adding # at the start:
# export ANTHROPIC_API_KEY="sk-ant-api03-..."
Save the file, then reload it:
source ~/.bashrc
Verify the key is gone — this must print nothing:
echo $ANTHROPIC_API_KEY
Removing the API key alone may not be enough if Claude Code has cached credentials from a previous session. Delete the credentials file to force a clean login:
rm ~/.claude/.credentials.json
Run Claude Code and it will prompt you to choose a login method:
claude
Select "Claude account with subscription" (or "Login with claude.ai"). A browser window will open — log in with your claude.ai credentials. After authorizing, return to Git Bash.
Claude Code saves your subscription credentials and will not prompt you again.
Start a new Claude Code session and confirm it starts without requesting an API key or login:
claude
You should reach the Claude Code prompt immediately. You can also check which account is active from within Claude Code with /account.
This is the most common issue on Windows. There are several causes:
Cause 1: Wrong terminal — API key is not loaded
The API key is set in ~/.bashrc, which only loads in Git Bash. If you open Claude from PowerShell, Command Prompt, or Windows Terminal using PowerShell, the key won't be present.
Fix: Always open Claude Code from Git Bash.
To verify: in your terminal, run echo $ANTHROPIC_API_KEY. If it prints nothing, the key is not loaded in that shell session.
Cause 2: .bashrc is not being sourced automatically
On some Windows Git Bash setups, .bashrc is not loaded by default for login shells — only .bash_profile is.
Fix: Add this line to ~/.bash_profile (create it if it doesn't exist):
[ -f ~/.bashrc ] && source ~/.bashrc
Then close and reopen Git Bash.
Cause 3: API key was set with wrong syntax
Check that your ~/.bashrc line looks exactly like:
export ANTHROPIC_API_KEY="sk-ant-api03-..."
Common mistakes:
export — the key won't be visible to child processes= sign — bash does not allow export KEY = "value"Cause 4: Browser-based login is failing (oauth popup)
For API key users: If Claude Code tries to open a browser for login and nothing happens, it's likely because the API key is missing and it's falling back to oauth login — but the browser link fails silently.
Fix: Set the API key (Step 2 above). Once ANTHROPIC_API_KEY is set, Claude Code skips the browser login entirely.
For subscription users: If the browser window didn't open, look for a URL printed in the terminal and paste it into your browser manually. After authorizing, return to the terminal — Claude Code will detect the completed login automatically.
If the browser login completes but you're still prompted on the next run, the credentials file may not have been saved. Check that ~/.claude/.credentials.json exists:
ls ~/.claude/.credentials.json
If it's missing, run claude again and complete the browser login a second time.
Cause 5: Stale/corrupt credentials file
If a previous login attempt left a bad credentials file, Claude may loop on the login screen.
Fix: Delete the credentials file and let it recreate:
rm ~/.claude/.credentials.json
Then restart Claude Code.
npm global binaries are not in your PATH.
Fix: Find the npm global bin directory and add it to PATH:
npm bin -g
Copy that path and add it to ~/.bashrc:
export PATH="$PATH:/c/Users/YourName/AppData/Roaming/npm"
The GSD hooks are stored in ~/.claude/hooks/ and referenced from ~/.claude/settings.json.
If they're missing after /gsd-update, run it again from inside a Claude Code session.
To check if hooks are present:
ls ~/.claude/hooks/
You should see files like gsd-statusline.js, gsd-context-monitor.js, etc.
This means the Claude Code postinstall script didn't run (common with certain npm configurations).
Fix:
node "$(npm root -g)/@anthropic-ai/claude-code/install.cjs"
npm install -g @anthropic-ai/claude-code completedANTHROPIC_API_KEY exported in ~/.bashrc~/.bash_profile sources ~/.bashrcclaude first run/gsd-update run inside Claude Codeclaude starts without a login promptClaude Code version used when making doc: @anthropic-ai/claude-code@2.1.117
GSD: open-source (https://github.com/open-gsd/gsd-core)
Node version: v24.14.1