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.
[PROJECT_NAME] adalah nama project Google Cloud Anda.
[REPO_NAME] adalah nama repositori Anda.
Kirim kode Anda ke Cloud Source Repositories:
git push --all google
Menggunakan repositori sebagai remote
RepositoriGoogle Cloud adalah repositori Git yang dilengkapi berbagai fitur. Anda dapat menggunakan
kumpulan perintah Git standar untuk berinteraksi dengan repositori ini, termasuk
push, pull, clone, dan log.
Mendorong ke repositori Google Cloud
Untuk melakukan push dari repositori Git lokal ke repositori Google Cloud , masukkan
perintah berikut:
git push google master
Menarik dari repositori Google Cloud
Untuk menarik dari repositori Google Cloud ke repositori Git lokal Anda, masukkan
perintah berikut:
git pull google master
Melihat histori commit repositori Google Cloud
Untuk melihat histori commit, masukkan perintah berikut:
git log google/master
Langkah selanjutnya
Setelah mendorong repositori lokal ke komputer lokal, Anda dapat:
[[["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,["# Pushing code from an existing repository\n\nThis topic describes how to push code from an existing repository on your local\nmachine to Cloud Source Repositories.\n\nBefore you begin\n----------------\n\nYou must have a repository in Cloud Source Repositories. To create a\nrepository, see\n[Creating an empty repository](/source-repositories/docs/creating-an-empty-repository).\n\nPush a local repository into Cloud Source Repositories\n------------------------------------------------------\n\nYou can push a local repository to Cloud Source Repositories by using either\nSSH, the Google Cloud CLI, or manually generated credentials. \n\n### SSH\n\n1. Ensure you have\n [set up local authentication](/source-repositories/docs/authentication#ssh)\n with SSH.\n\n2. Add your local repository as a remote:\n\n git remote add google ssh://[EMAIL]@source.developers.google.com:2022/p/[PROJECT_ID]/r/[REPO_NAME]\n\n Where:\n - `[EMAIL]` is your Google Cloud username.\n - `[PROJECT_ID]` is the ID of the Google Cloud project where the repository is located.\n - `[REPO_NAME]` is the name of the repository.\n\n For example: \n\n git remote add google ssh://user@gmail.com@source.developers.google.com:2022/p/example-project/r/test-repo\n\n3. Push your code to Cloud Source Repositories:\n\n git push --all google\n\n### gcloud CLI\n\n1. Ensure that\n [the gcloud CLI is installed](/source-repositories/docs/authentication#authenticate-using-the-cloud-sdk) on your machine.\n\n2. Open a terminal window.\n\n3. If you're using Windows, enter the following command:\n\n gcloud init && git config credential.helper gcloud.cmd\n\n If you're using Linux or macOS, enter the following command: \n\n gcloud init && git config credential.helper gcloud.sh\n\n4. Add your local repository as a remote:\n\n git remote add google \\\n https://source.developers.google.com/p/[PROJECT_NAME]/r/[REPO_NAME]\n\n Where:\n - `[PROJECT_NAME]` is the name of your Google Cloud project.\n - `[REPO_NAME]` is the name of your repository.\n5. Push your code to Cloud Source Repositories:\n\n git push --all google\n\n### Manual\n\n1. Ensure you have\n [generated and stored your Git credentials](/source-repositories/docs/authentication#manually-generated-credentials).\n\n2. Open a terminal window and add your local repository as a remote:\n\n git remote add google \\\n https://source.developers.google.com/p/[PROJECT_NAME]/r/[REPO_NAME]\n\n Where:\n - `[PROJECT_NAME]` is the name of your Google Cloud project.\n - `[REPO_NAME]` is the name of your repository.\n3. Push your code to Cloud Source Repositories:\n\n git push --all google\n\nUse the repository as a remote\n------------------------------\n\nGoogle Cloud repositories are fully featured Git repositories. You can use\nthe standard set of Git commands to interact with these repositories, including\n`push`, `pull`, `clone`, and `log`.\n\n### Push to a Google Cloud repository\n\nTo push from your local Git repository to a Google Cloud repository, enter\nthe following command: \n\n git push google master\n\n### Pull from a Google Cloud repository\n\nTo pull from a Google Cloud repository to your local Git repository, enter\nthe following command: \n\n git pull google master\n\n### View the commit history of a Google Cloud repository\n\nTo view the commit history, enter the following command: \n\n git log google/master\n\nWhat's next\n-----------\n\nAfter you push your local repository to your local machine, you can:\n\n- [Learn from your code's history](/source-repositories/docs/history-overview).\n- [Search your code](/source-repositories/docs/searching-code)."]]