Mulai 17 Juni 2024, Cloud Source Repositories tidak tersedia untuk pelanggan baru. Jika organisasi Anda belum pernah menggunakan Cloud Source Repositories, Anda tidak dapat mengaktifkan API atau menggunakan Cloud Source Repositories. Project baru yang tidak terhubung ke organisasi tidak dapat mengaktifkan Cloud Source Repositories API. Organisasi yang telah menggunakan Repositori Sumber Cloud sebelum 17 Juni 2024 tidak akan terpengaruh oleh perubahan ini.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat menggunakan Cloud Source Repositories untuk membuat repositori kosong yang baru. Membuat repositori berguna saat Anda ingin memulai project atau mencadangkan repositori Git menggunakan Cloud Source Repositories.
Sebelum memulai
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.
Di kolom Nama repositori, ketik nama untuk repositori baru.
Perhatikan bahwa nama All-Users dan All-Projects adalah nama yang dibatasi
dan tidak dapat digunakan.
Di menu drop-down Project, pilih project Google Cloud
tempat repositori berada.
Dengan [REPO_NAME] adalah nama untuk repositori Anda. Perhatikan bahwa nama
All-Users dan All-Projects adalah nama yang dibatasi dan tidak dapat digunakan.
Membuat project
Semua repositori harus dimiliki oleh project Google Cloud . Jika tidak memiliki
project Google Cloud , Anda dapat membuatnya dengan mengikuti langkah-langkah berikut.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]