Git commands freeze during commit/push workflow due to pager interaction
Description
Git commands (particularly git diff, git log, and sometimes git status) freeze/hang indefinitely during Claude Code's commit and push workflow, even when core.pager=cat is configured globally.
Steps to Reproduce
- Ask Claude to commit and push changes to a repository
- Claude Code executes the commit workflow which includes running
git status,git diff, andgit log - The process freezes when
git diffis executed - The command shows "Running..." status and never completes
Expected Behavior
Git commands should complete successfully without hanging, allowing the commit and push workflow to proceed.
Actual Behavior
The git diff command hangs indefinitely, blocking the entire commit/push operation.
Root Cause
Even with core.pager=cat set globally, git commands run by Claude Code's Bash tool still attempt to use an interactive pager, which hangs waiting for user input in the non-interactive environment.
Workaround
Using git --no-pager diff (and similar for other commands) works correctly and completes immediately.
Proposed Solution
The Bash tool should automatically add the --no-pager flag when executing git commands that might trigger a pager, such as:
git diffgit loggit showgit blame- etc.
Alternatively, Claude Code could set the GIT_PAGER environment variable to cat or empty string before executing any git commands.
Environment
- Platform: Windows (win32)
- Git version: (standard Windows git installation)
- Claude Code: Latest version
- Global git config:
core.pager=cat(already set)
Additional Context
This issue has recurred even after applying the recommended fix of setting core.pager=cat globally, suggesting that the environment variables or configuration may not be properly inherited by the Bash tool's subprocess execution context.
The issue specifically affects the automated commit workflow described in Claude Code's system instructions for git operations.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗