What this thread does
As of November 19, 2026, 2.1.69 lists a fix for 2>nul in Git Bash. Do first: update Claude Code, then handle any existing file using the cleanup options below.
The problem
On Windows, Claude Code sometimes leaves a regular file named nul in the working folder. nul is a reserved device name on Windows, so Explorer and many tools cannot delete or even stat it, and it can break git add, commit-message generators and folder deletes. The GitHub issue was opened on 2025-08-01 by rweijnen (version 1.0.62). As of November 19, 2026, the issue is closed and automatically locked.
Likely cause
The reporter guessed Unix-style null redirection was being turned into a Windows one. The release notes list a fix for literal nul file creation on Windows from CMD-style 2>nul redirection in Git Bash. One commenter found a leftover nul file holding the text of a failed Python one-liner that Claude had run while mapping a project. The reporter's guess and the commenter's report are user observations, not a maintainer diagnosis.
Maintainer response
A maintainer (ant-kurt) wrote on 2026-02-13 that adjustments were made in 2.1.42 and asked people to say if it still occurs. Commenters still reported the file on 2.1.63. The later 2.1.69 release notes explicitly name a fix for literal nul file creation from CMD-style 2>nul redirection in Git Bash. That is a specific prevention fix, not a cleanup command for files already present.
Ways to delete the file (commenter-reported)
- Git Bash or WSL. A commenter said
rm nulin Git Bash removes it; another used WSL for the same. - Extended-length path prefix. The reporter said prefixing the full path with the extended-length prefix, which is two backslashes, a question mark and a backslash, lets Windows tools delete it. Two commenters posted scripts that use that prefix in bulk; they are third-party code, so read them before running.
- Archive trick. One commenter added the file to a 7-Zip archive with the option to delete files after compressing. They called it dumb but said it worked.
- Ask Claude Code. One commenter said asking Claude Code to remove the file it created worked.
- Third-party tool. A commenter also shared a small Explorer context-menu tool for deleting folders that contain
nul. It is third-party code, outside the deletion methods described here.
Preventing the commit problem
A commenter said they added nul to .gitignore and had no issues since; another worried it might affect Windows and did not confirm. Writing an OS reminder in CLAUDE.md did not stop it for at least one commenter. Others posted pre-execution hooks that rewrite shell commands; those are third-party scripts that change what Claude runs, so review them first. A commenter also argued the real cause is Claude mixing cmd, PowerShell and bash on Windows, which is an opinion.
Status
Reports after the 2.1.42 adjustment do not by themselves establish a failure of the later 2.1.69 fix. The thread is locked, so recurring cases on a current version need a new issue. Clean up the file, update, and include the shell and redirection command if it returns.
Sources
- Issue 4928: historical reports and deletion workarounds.
- Release 2.1.69: literal-file prevention fix for CMD redirection in Git Bash.
- Microsoft file naming reference: reserved NUL device name and extended-length path behavior.
- Claude Code changelog.
Started from a post by @rweijnen, packaged by the editor. Original post