自 2024 年 6 月 17 日起,新客戶無法使用 Cloud Source Repositories。如果貴機構先前未使用 Cloud Source Repositories,就無法啟用 API 或使用 Cloud Source Repositories。未連結至機構的新專案無法啟用 Cloud Source Repositories API。在 2024 年 6 月 17 日前使用 Cloud Source 存放區的機構不會受到這項異動影響。
提供意見
偵測安全金鑰
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
絕不可將安全金鑰儲存於版本控制系統中。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 存放區後,您可能會想瞭解以下主題:
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-06-16 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-06-16 (世界標準時間)。"],[],[]]