[Bug] Claude Code loads application .env file, breaking gh tool with incorrect GITHUB_TOKEN permissions

Resolved 💬 3 comments Opened Oct 25, 2025 by torbjorn-krepsco Closed Oct 29, 2025

Bug Description
Claude Code loads my .env file, which breaks some of its tools (e.g. gh). I'm writing an application that itself calls git pull, so I'm putting an env variable named GITHUB_TOKEN into my .env file. This token is for the _application_ and has different permissions than what I need for my actual development (in this case only code read permissions). But because CC has read the .env file, it can no longer successfulliy use the "gh" tool because it doesn't have permissions.

I don't think CC should load a .env file meant for _application runtime_ and use it for _development time_. This def happens in the VScode CC extension, haven't tried in the console version.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.0.26
  • Feedback ID: 6b777841-6e23-4e12-89fd-a865fae37b3e

Errors

[]

View original on GitHub ↗

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