Seit dem 17. Juni 2024 ist Cloud Source Repositories für Neukunden nicht mehr verfügbar. Wenn Ihre Organisation noch nicht Cloud Source Repositories verwendet hat, können Sie die API nicht aktivieren oder Cloud Source Repositories verwenden. Für neue Projekte, die nicht mit einer Organisation verbunden sind, kann die Cloud Source Repositories API nicht aktiviert werden. Organisationen, die Cloud Source Repositories vor dem 17. Juni 2024 verwendet haben, sind von dieser Änderung nicht betroffen.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Sie können Cloud Source Repositories verwenden, um ein neues, leeres Repository zu erstellen. Das Erstellen eines Repositorys ist hilfreich, wenn Sie ein Projekt starten oder ein Git-Repository mit Cloud Source Repositories sichern möchten.
Hinweise
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.
Wählen Sie Neues Repository erstellen aus und klicken Sie auf Weiter.
Die Seite Neues Repository erstellen wird geöffnet.
Geben Sie im Feld Repository-Name einen Namen für das neue Repository ein.
Die Namen All-Users und All-Projects sind eingeschränkt und können nicht verwendet werden.
Wählen Sie in der Drop-down-Liste Projekt das Projekt Google Cloudaus, zu dem das Repository gehört.
Rufen Sie aus der Befehlszeile folgenden Befehl auf:
gcloudinitgcloudsourcereposcreate[REPO_NAME]
Dabei ist [REPO_NAME] der Name für Ihr Repository. Die Namen All-Users und All-Projects sind eingeschränkt und können nicht verwendet werden.
Projekt erstellen
Alle Repositories müssen zu einem Google Cloud -Projekt gehören. Wenn Sie kein Google Cloud Projekt haben, können Sie mit den folgenden Schritten eines erstellen.
Klicken Sie auf der SeiteNeues Repository erstellen auf Projekt erstellen.
Das Dialogfeld Cloud-Projekt erstellen wird geöffnet.
Geben Sie im Feld Projektname einen Namen für das Google Cloud-Projekt ein.
Akzeptieren Sie im Feld Projekt-ID entweder die generierte Projekt-ID oder klicken Sie auf Projekt-ID bearbeiten, um eine andere Projekt-ID einzugeben.
Wählen Sie in der Drop-down-Liste Rechnungskonto ein Rechnungskonto aus.
Klicken Sie auf Rechnungskonto erstellen, um ein Rechnungskonto zu erstellen.
Nachdem Sie nun über ein Repository in Cloud Source Repositories verfügen, können Sie Ihren Code hinzufügen. Dies umfasst unter Umständen einen der folgenden Prozesse:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-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."]]