{"id":34717,"date":"2024-10-07T23:51:04","date_gmt":"2024-10-07T23:51:04","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=34717"},"modified":"2024-10-07T23:51:04","modified_gmt":"2024-10-07T23:51:04","slug":"configure-github-copilot-access-via-content-exclusion","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/configure-github-copilot-access-via-content-exclusion\/","title":{"rendered":"Configure GitHub Copilot Access via Content Exclusion"},"content":{"rendered":"<p><span data-contrast=\"auto\">Have you ever wanted greater control over the sensitive content\u00a0AI-powered tools can access in your repositories? You can now customize Copilot\u2019s access to your files with the newly announced <a href=\"https:\/\/docs.github.com\/en\/copilot\/managing-copilot\/managing-github-copilot-in-your-organization\/setting-policies-for-copilot-in-your-organization\/excluding-content-from-github-copilot\">GitHub Copilot Content Exclusion<\/a> in both Visual Studio and Visual Studio Code. Through this new process you can configure Copilot to ignore certain files in your repository \u2013 such as sensitive files or information &#8211; when generating responses. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Once content has been excluded from Copilot:\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<ul>\n<li><span data-contrast=\"none\">Code completion will not be available in the affected files.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335557856&quot;:16777215,&quot;335559739&quot;:0,&quot;335559740&quot;:279}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"none\">The content in affected files will not inform code completion suggestions in other files.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335557856&quot;:16777215,&quot;335559739&quot;:0,&quot;335559740&quot;:279}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"none\">The content in affected files will not inform GitHub Copilot Chat&#8217;s responses.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335557856&quot;:16777215,&quot;335559739&quot;:0,&quot;335559740&quot;:279}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">GitHub Copilot\u2019s granular control over content exclusion gives you the flexibility to enact company-wide security policies in your organization and prevent unauthorized access to sensitive information so developers can still benefit from Copilot across every step of the developer workflow.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">For further details, limitations, and the latest information, refer to the <\/span><a href=\"https:\/\/docs.github.com\/en\/copilot\/managing-copilot\/managing-github-copilot-in-your-organization\/setting-policies-for-copilot-in-your-organization\/excluding-content-from-github-copilot#about-content-exclusions-for-copilot\"><span data-contrast=\"none\">content exclusion documentation<\/span><\/a><span data-contrast=\"none\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335557856&quot;:16777215,&quot;335559739&quot;:0,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">Example: Excluding Content in the C++ STL<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:160,&quot;335559739&quot;:80,&quot;335559740&quot;:279}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"auto\">For example, imagine you are customizing\u00a0<\/span><a href=\"https:\/\/github.com\/microsoft\/STL\"><span data-contrast=\"none\">Microsoft&#8217;s implementation of the C++ Standard Library.<\/span><\/a><span data-contrast=\"auto\"> You rewrite the validation logic and add your own tools, which are\u00a0specific for your codebase and include proprietary information. You can exclude these changes from Copilot by excluding the entire tools folder: \u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643.png\"><img decoding=\"async\" class=\"wp-image-34726 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643.png\" alt=\"A screenshot of a file that includes the line &quot;\/tools\/**\/*&quot; and says &quot;paths to exclude in this repository&quot; at the top\" width=\"621\" height=\"296\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643.png 1322w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643-300x143.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643-1024x488.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/Screenshot-2024-10-07-141643-768x366.png 768w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\">When you open any of the excluded files in your IDE, you can now determine that Copilot is disabled from the GitHub Copilot indicator in your status bar. For example, when opening tools\/validate\/validate.cpp in VS Code and hovering over the GitHub icon, you\u2019ll notice that the file has been excluded:\u00a0 <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file.png\"><img decoding=\"async\" class=\"aligncenter wp-image-34728\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file.png\" alt=\"Image of a mouse hovering over the Copilot Icon in the status bar of VS Code. The icon has a line over it and text that appears when it hovers states &quot;Your repository &quot;STL&quot; has disabled copilot for this file&quot;\" width=\"717\" height=\"167\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file.png 1614w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file-300x70.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file-1024x239.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file-768x179.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/disabled_copilot_for_file-1536x358.png 1536w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\">Now, when you make a request to Copilot, any excluded content will be ignored. This applies to both in line code completions and GitHub Copilot Chat, and is indicated by a note at the end of each response:\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image.png\"><img decoding=\"async\" class=\"wp-image-34729 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image.png\" alt=\"Screenshot of a code completion in VS Code. It has been cropped to show that the bottom of the inline suggestion shows the text &quot;note: some files were excluded from the context due to content exclusion rules&quot;\" width=\"442\" height=\"322\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image.png 1951w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-300x219.png 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-1024x747.png 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-768x561.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-1536x1121.png 1536w\" sizes=\"(max-width: 442px) 100vw, 442px\" \/><\/a><\/p>\n<p><img decoding=\"async\" class=\"wp-image-34730 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2.png\" alt=\"A screenshot of the copilot chat response in VS Code. It shows that at the bottom of the reponse there is the same note as for inline suggestions whenever a file is referenced that has been excluded. \" width=\"338\" height=\"503\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2.png 1173w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2-202x300.png 202w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2-688x1024.png 688w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2-768x1143.png 768w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2024\/10\/image-2-1033x1536.png 1033w\" sizes=\"(max-width: 338px) 100vw, 338px\" \/><\/p>\n<p><span data-contrast=\"none\">For further information and the latest details, please reference the <\/span><a href=\"https:\/\/docs.github.com\/en\/copilot\/managing-copilot\/managing-github-copilot-in-your-organization\/setting-policies-for-copilot-in-your-organization\/excluding-content-from-github-copilot\"><span data-contrast=\"none\">content exclusion documentation.<\/span><\/a><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">Excluding Files Not in Git?<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:160,&quot;335559739&quot;:80,&quot;335559740&quot;:279}\">\u00a0<\/span><\/h3>\n<p><span data-contrast=\"none\">A new addition, currently in public beta, is that content exclusion is not only limited to files that are tracked through Git. Any exclusions added <\/span><a href=\"https:\/\/github.blog\/changelog\/2024-08-19-content-exclusion-beta-now-supports-non-git-files\/\"><span data-contrast=\"none\">apply to any non-git files that are a part of your repository<\/span><\/a><span data-contrast=\"none\"> as well. For example, as a game developer, indicating a wildcard scope like \u201c*.exe\u201d from the previous section would automatically apply to any files in your repository, even if these .exe files are tracked through Azure DevOps, Perforce, or stored locally.\u00a0\u00a0<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;201341983&quot;:0,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0,&quot;335559737&quot;:0,&quot;335559738&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<h3 aria-level=\"2\"><span data-contrast=\"none\">What do you think?\u00a0<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;201341983&quot;:0,&quot;335559738&quot;:160,&quot;335559739&quot;:80,&quot;335559740&quot;:279}\">\u00a0<\/span><\/h3>\n<p><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=GitHub.copilot\"><span data-contrast=\"none\">Download the GitHub Copilot Extension for Visual Studio Code <\/span><\/a><span data-contrast=\"none\">\u202ftoday to try content exclusion and let us know what you think. Note that the GitHub Copilot extension comes bundled with the GitHub Copilot Chat extension.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">If you have any questions, comments, or feedback please reach out via the comments below, per email at\u202f <\/span><a href=\"mailto:visualcpp@microsoft.com\"><span data-contrast=\"none\">visualcpp@microsoft.com,<\/span><\/a><span data-contrast=\"none\"> or through our team on X\/Twitter at \u202f<\/span><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"none\">@<\/span><\/a><a href=\"https:\/\/twitter.com\/visualc\"><span data-contrast=\"none\">VisualC.<\/span><\/a><span data-contrast=\"auto\"> If you experience any issues, please report them in <\/span><a href=\"https:\/\/github.com\/microsoft\/vscode-copilot-release\/issues\/new\/choose\"><span data-contrast=\"none\">our GitHub repo<\/span><\/a><span data-contrast=\"auto\">. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:240,&quot;335559740&quot;:279}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted greater control over the sensitive content\u00a0AI-powered tools can access in your repositories? You can now customize Copilot\u2019s access to your files with the newly announced GitHub Copilot Content Exclusion in both Visual Studio and Visual Studio Code. Through this new process you can configure Copilot to ignore certain files in your [&hellip;]<\/p>\n","protected":false},"author":101195,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3940,3949,3920,275],"tags":[],"class_list":["post-34717","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-copilot","category-copilot-2","category-github","category-visual-studio-code"],"acf":[],"blog_post_summary":"<p>Have you ever wanted greater control over the sensitive content\u00a0AI-powered tools can access in your repositories? You can now customize Copilot\u2019s access to your files with the newly announced GitHub Copilot Content Exclusion in both Visual Studio and Visual Studio Code. Through this new process you can configure Copilot to ignore certain files in your [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/101195"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=34717"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/34717\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=34717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=34717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=34717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}