[BUG] git submodule add silently fails via Bash tool
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Bug Report: git submodule add silently fails via Bash tool
---
What's Wrong?
git submodule add <url> <path> executed via Claude Code's Bash tool exits with code 0 but produces no effect — no .gitmodules file is created, no directory is cloned, and no error output is emitted.
The same command works perfectly when run directly in Git Bash outside of Claude Code.
The internal git clone subprocess that git submodule add spawns appears to be blocked or swallowed by Claude Code's execution environment. This also affects git submodule update --init.
Notably, top-level git clone commands work fine via the Bash tool — only the child process spawned internally by git-submodule is affected.
Environment
- Claude Code Version: 2.1.22
- Claude Model: Opus
- Platform: Anthropic API
- OS: Windows (MINGW64_NT-10.0-26200)
- Terminal: Windows Terminal / Git Bash in Cursor
- Git Version: 2.51.1.windows.1
- Is this a regression? I don't know
What Should Happen?
What Should Happen?
git submodule add should clone the repository into the specified path, create/update .gitmodules, and stage the changes — identical to running the command directly in a terminal.
Error Messages/Logs
## Error Messages/Logs
# Via Claude Code Bash tool:
$ cd "D:/Code Stage/Freelance/FlyCow Games/FlyCow-MySuperGame"
$ git submodule add https://github.com/FlyCowGames/ZapFrameworkPackages.git ZapFrameworkPackages
# Exit code: 0
# stdout: (empty)
# stderr: (empty)
# Result: no .gitmodules created, no directory cloned
# GIT_TRACE output shows the command starts but the internal clone never executes:
$ GIT_TRACE=1 git submodule add https://github.com/FlyCowGames/ZapFrameworkPackages.git ZapFrameworkPackages
# trace: exec: git-submodule add https://github.com/FlyCowGames/ZapFrameworkPackages.git ZapFrameworkPackages
# trace: run_command: git-submodule add ...
# trace: start_command: git-submodule add ...
# (no further output — internal clone never runs)
# Python subprocess.run also reproduces the issue within Claude Code.
# Direct execution in Git Bash works perfectly.
Steps to Reproduce
Steps to Reproduce
- Open Claude Code in Git Bash on Windows
- Create or navigate to a git repository with at least one commit
- Ask Claude to run:
git submodule add https://github.com/any/public-repo.git SubmodulePath - Observe exit code 0 but no
.gitmodulesand no cloned directory - Run the same command directly in Git Bash — it succeeds
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.22
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Cursor
Additional Information
Additional Information
- Both SSH (
git@github.com:...) and HTTPS (https://github.com/...) URLs fail identically - Top-level
git cloneworks fine via the Bash tool — only the subprocess spawned bygit submodule addis affected git submodule update --init --recursivealso silently fails (same root cause)- Workaround: manually clone the repo, then register the submodule via
git config -f .gitmodulesandgit submodule absorbgitdirs
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗