AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Block GitHub Copilot from Suggesting Public and Copyrighted Code

Daly Zaloom · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

If you write proprietary software and use GitHub Copilot, you should flip one setting right now: change Suggestions matching public code to Block.

At 365Finds, our stance on this is unambiguous. Allowing an AI pair programmer to inject verbatim open-source blocks into commercial codebases is an unnecessary liability. While GitHub markets "Code Referencing" as an educational compromise, in enterprise development, relying on a developer to manually verify GPL license terms during an auto-complete suggestion is an organizational failure waiting to happen.

Here is exactly how to configure the public code filter across personal, organization, and enterprise accounts, followed by the hard technical and legal limits every engineering team must understand.


1. How to Turn on the Filter

GitHub enforces settings hierarchically: Enterprise policies override Organization policies, which override Individual settings. Where you configure the block depends on who pays for your seat.

For Individual Subscribers (Copilot Pro / Personal)

If you pay for your own GitHub Copilot subscription:

  1. Sign in to GitHub.com.
  2. Click your profile picture in the top-right corner and select Settings.
  3. In the left navigation menu, locate the "Code, planning, and automation" section and click Copilot.
  4. Find the section labeled Suggestions matching public code.
  5. Open the dropdown menu and select Block.
  6. Click Save.

If this dropdown is grayed out or locked, your seat is administered by an employer or organization whose centralized policy supersedes your local preference.

For Organization Owners (Copilot Business)

If you manage a development team:

  1. Navigate to your Organization’s home page on GitHub.
  2. Click Settings in the organization header.
  3. In the left sidebar, click Copilot > Policies.
  4. Locate Suggestions matching public code.
  5. Select Block from the dropdown menu to enforce this rule for all assigned members.

For Enterprise Administrators (Copilot Enterprise)

If you manage multiple GitHub organizations under an Enterprise Cloud account:

  1. Go to your Enterprise account page on GitHub.
  2. In the sidebar, select Policies > Copilot.
  3. Under Suggestions matching public code, choose Block.
  4. Ensure the policy is set to enforce across all child organizations rather than delegating permission to individual organization owners.

When conflicting seat policies exist across multiple organizations a developer belongs to, GitHub defaults to the most restrictive policy.


2. What the Filter Actually Does

When set to Block, GitHub Copilot engages a duplication detection filter. Before delivering an autocompletion suggestion, Copilot checks the proposed code along with roughly 150 characters of surrounding context (approximately 65 code tokens) against GitHub’s index of public code repositories.

If the suggestion and its immediate context match or closely mirror an existing public repository, Copilot suppresses the output entirely. The developer receives either an alternative non-matching completion or silence.

If you leave this setting on Allow, Copilot serves the matching code. Depending on your editor setup, it may display a "code referencing" notification indicating the source repository, matching URL, and detected license (such as MIT, Apache 2.0, or GPL-3.0). But seeing a notification after code is already suggested puts the compliance burden directly onto the individual programmer's keyboard.


3. The Indemnification Catch: Why "Block" is Legally Mandatory

For commercial teams, the duplication filter is not merely an engineering preference; it is a legal requirement.

Microsoft and GitHub offer a Customer Copyright Commitment (IP Indemnification) for paid commercial tiers (Copilot Business and Copilot Enterprise). Under this agreement, GitHub pledges to defend and indemnify commercial customers against third-party copyright infringement lawsuits arising from generated code.

However, that protection comes with strict contractual caveats:

365Finds considers running Copilot in commercial repositories with this setting set to "Allow" an unforced risk. You sacrifice legal protection for snippets you could easily write yourself or legitimately pull via vetted package managers.


4. The Blind Spots: Where the Filter Falls Short

Flipping the toggle to "Block" is essential, but at 365Finds, we caution against treating it as an absolute shield. The technical filter has clear structural limitations:

  1. The 150-Character Threshold: Short snippets, utility functions, or algorithmic idioms under 150 characters routinely bypass the filter because there is not enough context to trigger a confident fingerprint match.
  2. Surface Coverage: The filter checks public repositories on GitHub. It does not index private repositories, alternative git forges (GitLab, Bitbucket), Stack Overflow threads, technical blogs, or academic papers. If copyrighted code exists elsewhere on the web, Copilot might reproduce it without the filter ever noticing.
  3. Minor Variations: Slight syntactic refactoring or variable renaming performed by the underlying LLM can mutate a snippet just enough to evade exact-match heuristics while preserving the underlying protected logic.

For closed-source commercial projects, blocking public code in GitHub Copilot settings is step one. Step two is maintaining automated Software Composition Analysis (SCA) tooling in your CI/CD pipeline to continuously scan committed code for licensing anomalies before deployment.

References