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.
Puoi utilizzare Cloud Source Repositories per creare un nuovo repository vuoto. La creazione di un repository è utile quando vuoi avviare un progetto o eseguire il backup di un repository Git utilizzando Cloud Source Repositories.
Prima di iniziare
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
Viene visualizzata la pagina Aggiungi un repository.
Seleziona Crea nuovo repository e fai clic su Continua.
Viene visualizzata la pagina Crea nuovo repository.
Nel campo Nome repository, digita un nome per il nuovo repository.
Tieni presente che i nomi All-Users e All-Projects sono nomi con limitazioni
e non possono essere utilizzati.
Nell'elenco a discesa Progetto, seleziona il Google Cloud
progetto a cui appartiene il repository.
Dove [REPO_NAME] è il nome del repository. Tieni presente che i nomi
All-Users e All-Projects sono nomi con limitazioni e non possono essere utilizzati.
Crea un progetto
Tutti i repository devono appartenere a un progetto Google Cloud . Se non hai
un Google Cloud progetto, puoi crearne uno seguendo questi passaggi.
Nella paginaCrea nuovo repository, fai clic su
Crea progetto.
Si apre la finestra di dialogo Crea progetto Cloud.
Nel campo Nome progetto, digita un nome per il progetto Google Cloud.
Nel campo ID progetto, accetta l'ID progetto generato o fai clic su
Modifica ID progetto per inserirne un altro.
Nell'elenco a discesa Account di fatturazione, seleziona un account di fatturazione.
Per creare un account di fatturazione, fai clic su Crea account di fatturazione.
[[["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-11 UTC."],[],[],null,["# Creating an empty repository\n\nYou can use Cloud Source Repositories to create a new, empty repository. Creating a\nrepository is useful when you want to start a project or back up a Git\nrepository using Cloud Source Repositories.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\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 [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\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 [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n2. If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n3.\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n4. [Verify that you have the latest version of Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).\n5. If you have not configured your user credentials in Git, follow the [first time setup instructions.](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup)\n6. Enable the Cloud Source Repositories API.\n7. [Enable the Cloud Source Repositories API](https://console.cloud.google.com/flows/enableapi?apiid=sourcerepo.googleapis.com&redirect=https://cloud.google.com/source-repositories/docs/creating-an-empty-repository)\n\nCreate a new repository\n-----------------------\n\nYou can create a repository by using either the Google Cloud console or the `gcloud`\ncommand-line tool. \n\n### Console\n\n1. In the Google Cloud console, open Cloud Source Repositories.\n\n [Open Cloud Source Repositories](https://source.cloud.google.com/repos)\n2. Click **Add repository**.\n\n The **Add a repository** page opens.\n3. Select **Create new repository** and click **Continue**.\n\n The **Create new repository** page opens.\n4. In the **Repository name** field, type a name for the new repository.\n Note that the names `All-Users` and `All-Projects` are restricted names\n and cannot be used.\n\n5. In the **Project** drop-down list, select the Google Cloud\n project the repository belongs to.\n\n To [create a new Google Cloud project](#create_a_project), click\n **Create project**.\n6. Click **Create**.\n\n Your repository is created, and the **Add code to your repository** page\n opens. This page provides instructions on how to\n [clone the repository to your local machine](/source-repositories/docs/cloning-repositories)\n or\n [push code from an existing repository](/source-repositories/docs/pushing-code-from-a-repository)\n based on your authentication type.\n\n### gcloud\n\n1. From the command line, call:\n\n gcloud init\n gcloud source repos create [REPO_NAME]\n\n Where `[REPO_NAME]` is the name for your repository. Note that the names\n `All-Users` and `All-Projects` are restricted names and cannot be used.\n\nCreate a project\n----------------\n\nAll repositories must belong to a Google Cloud project. If you don't have\na Google Cloud project, you can create one by following these steps.\n\n1. On the **Create new repository** [page](#create_a_new_repository), click\n **Create project**.\n\n The **Create Cloud project** dialog opens.\n2. In the **Project name** field, type a name for the Google Cloud\n project.\n\n3. In the **Project ID** field, either accept the generated project ID or click\n **Edit Project ID** to enter a different one.\n\n | **Note:** Your Google Cloud project ID must be unique across Google Cloud.\n4. In the **Billing Account** drop-down list, select a billing account.\n\n To create a billing account, click **Create billing account**.\n5. Click **Create**.\n\nYou can continue [creating a new repository](#create_a_new_repository).\n\nWhat's next\n-----------\n\nNow that you have a repository in Cloud Source Repositories, you can now add\nyour code, which might involve either of these processes:\n\n- [Cloning your new repository](/source-repositories/docs/cloning-repositories) to your local machine.\n- [Pushing code from an existing repository](/source-repositories/docs/pushing-code-from-a-repository) on your local machine."]]