If you allow GitHub Copilot to make suggestions that match publicly available code, Copilot will display references to any similar code that is found. See GitHub Copilot code referencing.
References to matching code are only generated if Copilot is configured to allow suggestions that match publicly available code. This is configured in either your personal or organization settings.
2025年02月26日 09:22:12,045 [5581906] INFO - #copilot - [Public Code References] Text found matching public code in file:///Users/mona-lisa/git-repos/test-repo/fizzbuzz.js [Ln 1, Col 10] near fizzBuzz() ...:
1) [NOASSERTION] https://github.com/nixsticks/todos/blob/ae427a721c7784da64a619ba17f60637fe1cc819/Loops/fizzbuzz/fizzbuzz.js
2) [GPL-3.0] https://github.com/voloslg/algocasts/blob/34b423517486f908ca167b390d3b8bd05653829f/exercises/fizzbuzz/index.js
The log entry includes the following details:
The date and time you accepted the suggestion.
A "Public Code References" message telling you that similar code was found.
The path to the file in which the suggestion was added.
The line and column number where the suggestion was added.
A list of matches, including:
The license type for the matching code—or NOASSERTION if no license was found.
The URL of the file on GitHub.com where the matching code was found.
You can verify that code referencing is working by prompting Copilot to add some commonly used code and checking the output in the log.
Create a file called fizz-buzz.js and open it in the editor.
Display the log as described in the previous section.
In the editor, type:
functionfizzBuzz()
With a space after the closing parenthesis.
GitHub Copilot should suggest code to complete the function. Typically the suggestion will be a common implementation of the fizz buzz algorithm that will match publicly available code on the GitHub website.
To accept the suggestion, press Tab.
Check whether any entries for similar code have been added to the log.
You can verify that code referencing is working by prompting Copilot to add some commonly used code and checking the output in the log.
Create a file called fizz-buzz.js and open it in the editor.
Display the log as described in the previous section.
In the editor, type:
functionfizzBuzz()
With a space after the closing parenthesis.
GitHub Copilot should suggest code to complete the function. Typically the suggestion will be a common implementation of the fizz buzz algorithm that will match publicly available code on the GitHub website.
To accept the suggestion, press Tab.
Check whether any entries for similar code have been added to the log.
09:39:16:203 [Completions Public Code Match Information] Similar code with license type [MIT] https://github.com/octo-org/octo-repo/blob/34deb75eb6a2e22483ed465a6aec38c02eb2536e/routines/quicksort.js
You can verify that code referencing is working by prompting Copilot to add some commonly used code and checking the output in the log.
Create a file called fizz-buzz.js and open it in the editor.
Display the log as described in the previous section.
In the editor, type:
functionfizzBuzz()
With a space after the closing parenthesis.
GitHub Copilot should suggest code to complete the function. Typically the suggestion will be a common implementation of the fizz buzz algorithm that will match publicly available code on the GitHub website.
To accept the suggestion, press Tab.
Check whether any entries for similar code have been added to the log.
09:24:10:525 [Code Match] Similar code with 2 license type(s) [MIT, NOASSERTION]
09:24:10:525 ## License: MIT
09:24:10:525 https://github.com/octo-org/octo-repo/tree/127aac4ab27a42706af01be80f7aae3b83f44fbc/buzzfizz.py
09:24:10:525 ```
09:24:10:525 for i in range(1, n + 1):
09:24:10:525 if i % 3 == 0 and i % 5 == 0:
09:24:10:525 print('FizzBuzz')
09:24:10:525 elif i % 3 == 0:
09:24:10:525 print('Fizz')
09:24:10:525 elif i % 5 == 0:
09:24:10:525 ```
09:24:10:525 ## License: NOASSERTION
09:24:10:525 https://github.com/octo-org/monalisa/tree/011308746e53b26b128fa53c044a2527c39231f0/fizz-buzz.py
09:24:10:525 ```
09:24:10:525 i % 3 == 0 and i % 5 == 0:
09:24:10:525 print('FizzBuzz')
09:24:10:525 elif i % 3 == 0:
09:24:10:525 print('Fizz')
09:24:10:525 elif i % 5 == 0:
09:24:10:525 print('Buzz')
09:24:10:525 else:
09:24:10:525 print(i)
09:24:10:525 ```
When Copilot Chat provides a response that includes code that matches code in a public GitHub repository, this is indicated beneath the code suggestion:
<> Public code references from n repositories
To see details of the matching code:
Click the "Public code references..." text, under the code suggestion.
A list of GitHub repositories containing matching code is displayed in a dropdown, together with licensing information, if found.
Screenshot of a code completion suggestion in Copilot Chat with a link to view code references.
Click the name of a repository to display that repository on GitHub.com.