代码自定义概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
代码自定义是 Gemini Code Assist Enterprise 的一项功能,可让您从 Gemini Code Assist Enterprise 获取基于贵组织的专用代码库的代码建议,从而与贵组织的编码样式保持一致。
代码自定义功能可让 Gemini Code Assist Enterprise 通过分析私有代码并将其存储在私有索引中来访问您的私有代码库中的代码,如下图所示:
在您编写代码时,Gemini Code Assist 会在您的私有索引中搜索与您尝试编写的代码类似的代码。然后,它会在代码提示中添加相关匹配项,并将这些匹配项发送到 Gemini Code Assist 建议服务。代码自定义功能会每 24 小时重新编制代码库索引,以确保代码建议保持最新状态。Gemini Code Assist 会将生成的代码返回给您。
与仅限于搜索 IDE 中当前文件夹和打开标签页中的文件的完整代码库感知功能不同,代码自定义功能会搜索索引中的所有代码库。设置代码自定义后,它会作为代码补全和代码生成功能的一部分运行。
Gemini Code Assist 和代码自定义都是受管理服务。您可以按月按席位数授予使用许可。
确保对私有代码的访问和存储安全
Google 会通过多种方式来保护您存储的私有代码:
- 我们会在专用的单租户环境中对您的代码进行编入索引并进行存储。
- 管理员访问权限控制可帮助防止 Google 员工在没有正当理由或(如适用)明确批准的情况下访问您的内容。
- Gemini 模型不会使用您的私有源代码进行训练。
- 您的结果对您是私有的,我们不会与其他客户共享您的结果。
如需详细了解 Google 的安全措施,请参阅 Google 安全概览。
您可以通过以下方式控制对数据的访问权限:
- 您可以使用 Identity and Access Management 权限来控制哪些人可以从您的代码库中获取代码建议。
- 您可以创建
.aiexclude
文件,以指定 Gemini Code Assist 索引的特定代码库或其中的部分内容。
如需在 IDE 中配置代码自定义,请参阅配置 Gemini Code Assist 代码自定义。
限制
后续步骤
配置 Gemini Code Assist 代码自定义。
在 IDE 中配置代码自定义后,请参阅使用代码自定义。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-29。
[null,null,["最后更新时间 (UTC):2025-07-29。"],[[["\u003cp\u003eCode customization in Gemini Code Assist provides code suggestions tailored to your organization's private repositories and coding style by analyzing and indexing your code.\u003c/p\u003e\n"],["\u003cp\u003eGemini Code Assist uses a private index to search for code similar to what you're writing and includes relevant matches in the code prompt, updating the index every 24 hours to ensure suggestions are current.\u003c/p\u003e\n"],["\u003cp\u003eCode customization offers enhanced code search capabilities compared to full codebase awareness, as it searches all indexed repositories, rather than just the current folder and open tabs.\u003c/p\u003e\n"],["\u003cp\u003eGoogle secures private code through a dedicated single-tenant environment, administrative access controls, and ensures that the Gemini model doesn't train on your private code, while keeping your results private.\u003c/p\u003e\n"],["\u003cp\u003eCode Customization is available on VS Code Gemini Code Assist extension, IntelliJ Gemini Code Assist plugin, Cloud Workstations, and the Cloud Shell Editor, with limited support for GitHub.com and GitLab.com, as well as only being able to index certain programming languages.\u003c/p\u003e\n"]]],[],null,["| **Note:** Gemini Code Assist code customization is available only in Gemini Code Assist Enterprise. For more information, see [Gemini Code Assist supported features](/gemini-code-assist/docs/overview#supported-features).\n\nCode customization, a feature in\n\n[Gemini Code Assist](/gemini-code-assist/docs/overview) Enterprise,\nlets you get code suggestions from Gemini Code Assist\nEnterprise that are based on your organization's private repositories, and thus\naligned to your organization's coding style.\n\nCode customization gives Gemini Code Assist Enterprise access to\ncode in your private repositories by analyzing and storing it in a private\nindex, as the following diagram shows:\n\nAs you code, Gemini Code Assist searches your private index for\ncode that is similar to what you're trying to write. It then includes relevant\nmatches in the code prompt and sends these matches to the\nGemini Code Assist recommendations service. Code customization\nkeeps recommendations fresh by reindexing your codebase every 24 hours to\nensure that code suggestions remain up to date.\nGemini Code Assist returns the generated code to you.\n\nUnlike the full codebase awareness feature, which is limited to searching files\nin the current folder and open tabs in your IDE, code customization searches all\nrepositories in your index. After code customization is set up, it works as part\nof the code completion and code generation features.\n\nBoth Gemini Code Assist and code customization are managed\nservices. You license usage by seats per month.\n\nSecuring access and storage of private code\n\nGoogle provides security of your stored private code in several ways:\n\n- We index and store your code in a dedicated single-tenant environment.\n- [Administrative access controls](https://cloud.google.com/assured-workloads/cloud-provider-access-management/docs/administrative-access) help prevent Google employees from accessing your content without justification and, optionally, explicit approval.\n- The Gemini model doesn't train on your private source code.\n- Your results are private to you, and we don't share your results with other customers.\n\nFor further details on Google's security measures, see the\n[Google security overview](https://cloud.google.com/security/overview/whitepaper).\n\nHere's how you can control access to your data:\n\n- You can use Identity and Access Management permissions to help control individuals who can get code suggestions from your codebase.\n- You can [create an `.aiexclude` file](/gemini-code-assist/docs/code-customization#optional_choose_which_files_are_not_indexed) to choose specific repositories or parts of repositories that Gemini Code Assist indexes.\n\nTo configure code customization in your IDE, see\n\n[Configure Gemini Code Assist code customization](/gemini-code-assist/docs/code-customization).\n\n\nLimitations\n\n- Google limits the number of code repository indexes to one for each project and for each organization.\n- The maximum number of repositories that can be indexed is 20,000.\n- The maximum number of repository groups per code repository index is 500.\n- The maximum number of repositories per repository group is 500.\n- Code customization is supported in the VS Code Gemini Code Assist extension (version 2.18.0+), the IntelliJ Gemini Code Assist plugin (version 1.1.0), Cloud Workstations, and the Cloud Shell Editor.\n- Code customization supports repositories hosted on github.com, gitlab.com, bitbucket.org, and on-premises repositories hosted on GitLab Enterprise, GitHub Enterprise, and Bitbucket Data Center.\n- Code customization doesn't support [GitHub Enterprise Cloud IP restrictions](https://docs.github.com/en/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-allowed-ip-addresses-for-your-organization).\n- Code customization supports only Developer Connect connections in the following locations (regions):\n - `us-central1`\n - `europe-west1`\n - `asia-southeast1`\n- Code customization doesn't index documentation, media, or other non-code\n files. Additionally, code customization supports only the following\n languages:\n\n - C, C++, and C#\n - Golang\n - Java\n - JavaScript\n - Kotlin\n - PHP\n - Python\n - Rust\n - TypeScript\n\n All other coding languages are not indexed or used in code customization. To\n request support for a coding language, click **Send feedback** on this page,\n and then select **Product feedback**.\n\nWhat's next\n\n1.\n [Configure Gemini Code Assist\n code customization](/gemini-code-assist/docs/code-customization).\n\n2. Once you've configured code customization in your IDE, see\n\n [Use code customization](/gemini-code-assist/docs/use-code-customization)."]]