Tell Copilot to ignore files: a guardrail, not a lock

Can your AI coding helper use your sensitive files? GitHub Copilot content exclusion

Can your AI coding helper use your sensitive files? GitHub Copilot’s content exclusion setting lets admins tell it not to. It is useful, but it is a guardrail, not a lock.

Think of a “Do not use” note on a folder

Content exclusion works like a “Do not use” note on a folder. Copilot is told to ignore the files you list: inline suggestions are not available in them, their content is not used as context for Copilot’s answers, and they are not reviewed in a Copilot code review.

Who sets it, and where

  • Repository admins: the repository’s Settings, then Copilot, then Content exclusion.
  • Organisation owners: the organisation’s Settings, then Copilot, then Content exclusion. Rules apply to people with a Copilot seat from that organisation.
  • Enterprise owners: AI controls, then Copilot, then Content exclusion. Rules apply to every Copilot user in the enterprise.

GitHub’s organisation-level example uses “*” with “**/.env” to ignore every .env file. Changes can take up to 30 minutes to reach IDEs where the settings are already loaded; reloading the editor applies them sooner.

Status

GitHub announced general availability in IDEs on 12 November 2024, and in the GitHub Copilot app and Copilot CLI on 2 September 2026. The current docs also cover Copilot cloud sessions started on the GitHub website, GitHub Mobile or cloud sandboxes. Support varies by editor and feature, so check the table in GitHub Docs for your tools. The docs list it for Copilot Business and Copilot Enterprise plans; since 28 October 2026, GitHub Enterprise customers can also get Copilot with the same features as Copilot Enterprise.

A guardrail, not a lock

GitHub is clear that content exclusion “is not a filesystem security boundary and cannot guarantee prevention of every form of file access”. Agents check file paths in commands but might not detect indirect access, third-party MCP servers or clients may not respect it, Copilot can still see some details the IDE provides indirectly, and symlinks and remote filesystems are not covered.

Practical tip

Use content exclusion for config files and sensitive folders, test your rules before relying on them, especially with agents and third-party tools, and keep real secrets in a vault with proper permissions.

Sources

One practical AI idea a day from AI Powered 365.

Share this content:

I am Yogeshkumar Patel, a Microsoft Certified Architect and Azure AI Engineer specialising in enterprise ERP and intelligent automation. With deep expertise across Dynamics 365 Finance & Supply Chain, Power Platform, Azure, and AI engineering, I design and lead large-scale digital transformation initiatives that integrate business systems with advanced AI capabilities. With over six years of experience delivering multi-entity ERP rollouts, AI-driven automation, and secure cloud architectures, my focus is on building intelligent, scalable, and governance-led enterprise ecosystems that enhance operational efficiency, data-driven decision-making, and long-term strategic value. Holding a Master’s degree from the University of Bedfordshire, I specialise in integrating AI and agentic systems into core business processes streamlining supply chains, automating complex workflows, and enhancing insight-driven decisions through Power BI, orchestration frameworks, and governed AI architectures. Passionate about practical innovation and knowledge sharing, I created AIpowered365 to help businesses and professionals move beyond experimentation and adopt real-world, enterprise-ready AI and agent-driven solutions as part of their digital transformation journey. 📩 Let’s Connect: LinkedIn | Email 🚀

Post Comment


→ Table of Content