[BUG] Claude ignoring .gitignore and reading secret keys in .env - .claudeignore .env by default

Resolved 💬 4 comments Opened Mar 14, 2026 by xlcrr Closed Apr 12, 2026

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?

Claude is ignoring .gitignore

What Should Happen?

Claude should not have godmode access to .env

Error Messages/Logs

Steps to Reproduce

  1. Have .env & .gitignore
  2. Ask Claude to read it

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.76

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗