自 2024 年 6 月 17 日起,Cloud Source Repositories 将不再向新客户提供。如果您的组织之前未使用过 Cloud Source Repositories,则无法启用该 API 或使用 Cloud Source Repositories。未与组织相关联的新项目无法启用 Cloud Source Repositories API。2024 年 6 月 17 日之前使用过 Cloud Source Repositories 的组织不受此更改的影响。
发送反馈
检测安全密钥
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
任何时候不得将安全密钥存储在版本控制系统中。Cloud Source Repositories 可以帮助您防止用户将安全密钥存储在Google Cloud 代码库中。Cloud Source Repositories 可以检查以下类型的安全密钥:
Google Cloud 服务账号凭据(JSON 格式)
PEM 编码的私钥(包括 RSA、DSA 和 PGP)
此检查功能可免费用于所有代码库。
安全密钥检查功能如何工作
当用户执行 git push
命令时,检查功能将查找可能是安全密钥的数据。如果找到匹配项,则该功能将阻止 git
推送,并通知用户找到的内容和位置。例如:
The push has been rejected because we detect that it contains a private key.
Please check the following commands and confirm that it's intentional:
git show [COMMIT]
You can use `git rev-list --objects --all` to find the files.
To push these files, please run `git push -o nokeycheck`.
准备工作
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Note : If you don't plan to keep the
resources that you create in this procedure, create a project instead of
selecting an existing project. After you finish these steps, you can
delete the project, removing all resources associated with the project.
Go to project selector
停用安全密钥检测
要停用安全密钥检测,请使用以下 gcloud
命令:
gcloud init
gcloud source project-configs update --disable-pushblock
启用安全密钥检测
要启用私钥检测,请使用以下 gcloud
命令:
gcloud init
gcloud source project-configs update --enable-pushblock
覆盖安全密钥检测
要覆盖安全密钥检测功能,请使用以下 git
命令:
git push -o nokeycheck
后续步骤
设置 Google Cloud 代码库后,您可能会发现以下主题会有所帮助:
发送反馈
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-31。
需要向我们提供更多信息?
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-01-31。"],[],[]]