A partire dal 17 giugno 2024, Cloud Source Repositories non è disponibile per i nuovi clienti. Se la tua organizzazione non ha mai utilizzato Cloud Source Repositories, non puoi attivare l'API o utilizzare Cloud Source Repositories. I nuovi progetti non collegati a un'organizzazione non possono attivare l'API Cloud Source Repositories. Questa modifica non interessa le organizzazioni che hanno utilizzato Cloud Source Repositories prima del 17 giugno 2024.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Non devi mai archiviare le chiavi di sicurezza in un sistema di controllo delle versioni.
Cloud Source Repositories può aiutarti a impedire agli utenti di archiviare i token di sicurezza in un repositoryGoogle Cloud . Cloud Source Repositories
può controllare i seguenti tipi di token di sicurezza:
Google Cloud credenziali dell'account di servizio (formato JSON)
Chiavi private con codifica PEM (incluse RSA, DSA e PGP)
Questa funzionalità di controllo è disponibile senza costi aggiuntivi per tutti i repository.
Come funziona la funzionalità di controllo della chiave di sicurezza
Quando un utente esegue un comando git push, la funzionalità di controllo cerca dati
che potrebbero essere un token di sicurezza. Se viene trovata una corrispondenza, la funzionalità blocca la notifica push git
e comunica agli utenti cosa è stato trovato e dove. Ad esempio:
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`.
Prima di iniziare
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Detecting security keys\n\nYou should never store security keys in a version-control system.\nCloud Source Repositories can help you prevent users from storing security keys in a\nGoogle Cloud repository. Cloud Source Repositories\ncan check for the following types of security keys:\n\n- Google Cloud service account credentials (JSON format)\n- PEM-encoded private keys (including RSA, DSA, and PGP)\n\nThis checking feature is available for all repositories at no charge.\n\nHow the security-key checking feature works\n-------------------------------------------\n\nWhen a user executes a `git push` command, the checking feature looks for data\nthat might be a security key. If a match is found, the feature blocks the `git`\npush and notifies users what was found and where. For example: \n\n```\nThe push has been rejected because we detect that it contains a private key.\nPlease check the following commands and confirm that it's intentional:\n\ngit show [COMMIT]\n\nYou can use `git rev-list --objects --all` to find the files.\n\nTo push these files, please run `git push -o nokeycheck`.\n```\n| **Note:** To help store security keys more securely, consider using [Cloud Key Management Service](/kms/docs/store-secrets).\n\nBefore you begin\n----------------\n\n\nIn the Google Cloud console, on the project selector page,\nselect or create a Google Cloud project.\n| **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.\n\n[Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDisable security key detection\n------------------------------\n\nTo disable security key detection, use the following `gcloud` command: \n\n gcloud init\n gcloud source project-configs update --disable-pushblock\n\nEnable security key detection\n-----------------------------\n\nTo enable private key detection, use the following `gcloud` command: \n\n gcloud init\n gcloud source project-configs update --enable-pushblock\n\nOverride security key detection\n-------------------------------\n\nTo override the security key detection feature, use the following `git`\ncommand: \n\n git push -o nokeycheck\n\nWhat's next\n-----------\n\nAfter you set up a Google Cloud repository, you might find the following\ntopics helpful:\n\n- [Controlling access to repositories](/source-repositories/docs/configure-access-control)\n- [Using the source browser](/source-repositories/docs/using-source-browser)"]]