Membuat aplikasi baru dari contoh kustom di Cloud Code untuk VS Code
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Repositori contoh adalah repositori Git yang berisi contoh kustom yang dapat Anda gunakan untuk mengembangkan aplikasi. Setelah
menyiapkan repositori contoh
(atau repositori telah disiapkan untuk Anda), Anda dapat mulai membuat aplikasi dengan contoh
ini.
Atau, Anda dapat mengimpor repositori contoh kustom Cloud Code untuk mencoba pengalaman contoh kustom. Untuk lebih memahami cara menyiapkan repositori contoh kustom, sebaiknya Anda mencoba membuat fork repositori dan mengubah struktur serta kontennya sebelum mengimpornya. Anda dapat melakukannya dengan membuat contoh baru di repositori atau mengubah kode sumber untuk membuat versi aplikasi Contoh Kustom Kubernetes atau Hello World Anda sendiri.
Sebelum memulai
Pastikan Git versi 2.25.0 atau yang lebih baru telah diinstal di komputer lokal Anda.
Untuk mengikuti panduan langkah demi langkah tugas ini langsung di
Cloud Shell Editor, klik Pandu saya:
Untuk membuat aplikasi baru menggunakan contoh dari repositori contoh Anda:
Salin URL Git repositori contoh yang ingin Anda gunakan. Jika Anda
menggunakan repositori Git yang dihosting secara langsung di komputer lokal, akhiran .git
akan dihilangkan dan URL-nya berbentuk /path/to/repo.
Di status bar Cloud Code, klik nama project yang aktif.
Di menu Pilih Cepat yang muncul, pilih Aplikasi Baru.
Saat diminta untuk memilih jenis sampel yang akan digunakan, pilih Custom
application.
Klik Import Sample from Repo.
Saat diminta memasukkan URL, masukkan URL Git yang Anda salin sebelumnya.
URL dalam contoh ini menggunakan format GitHub HTTPS: https://github.com/username/repo-name.git.
Tips pemecahan masalah: Jika Anda mengalami masalah dengan autentikasi Git,
periksa apakah ekstensi Git bawaan VS Code diaktifkan (telusuri
@builtin git) dan setelan Git: Terminal Authentication di
Setelan pengguna dicentang.
Untuk menggunakan contoh versi terbaru di Cloud Code, klik
muat ulangMuat Ulang Template.
Periksa jendela terminal di IDE untuk mengonfirmasi bahwa repositori Anda telah berhasil di-clone.
Cabang default repositori akan otomatis digunakan. Untuk menggunakan cabang lain:
Edit cabang yang digunakan atau URL repositori dalam file settings.json
di bagian cloudcode.customApplications.
Klik Custom Application.
Klik
refreshRefresh.
Jika repositori Anda tidak berhasil di-clone,
Anda dapat menggunakan opsi Kelola Repositori untuk memperbarui detail repositori contoh
dengan URL dan/atau cabang Git yang valid.
Dari daftar sampel yang diperbarui, pilih sampel kustom Anda.
Masukkan nama dan lokasi project Anda.
Klik Create New Application.
Cloud Code membuat aplikasi menggunakan contoh yang Anda pilih dan membuka aplikasi untuk digunakan.
Dapatkan Dukungan
Untuk mengirim masukan, laporkan masalah di
GitHub,
atau ajukan pertanyaan di
Stack Overflow.
[[["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-09-04 UTC."],[[["\u003cp\u003eA sample repository in Git contains custom samples for developing applications, and can be set up or imported for use.\u003c/p\u003e\n"],["\u003cp\u003eYou can try the custom sample experience by importing the Cloud Code custom sample repository, and it's recommended to fork and modify it to understand its setup.\u003c/p\u003e\n"],["\u003cp\u003eTo create a new application from a sample repository, you need the Git URL of the repository, which should preferably be an HTTPS URL.\u003c/p\u003e\n"],["\u003cp\u003eAfter entering the Git URL into the application, you can refresh the templates, confirm the cloning in the terminal, and then select the custom sample to use.\u003c/p\u003e\n"],["\u003cp\u003eThe steps are provided to guide you on how to address issues with Git authentication, how to use different branches, and where you can find support or submit feedback.\u003c/p\u003e\n"]]],[],null,["# Create a new application from a custom sample in Cloud Code for VS Code\n\nA sample repository is a Git repository that contains custom samples you can use\nto develop applications. After you've\n[set up your sample repository](/code/docs/vscode/set-up-sample-repo)\n(or one has been set up for you), you can start creating applications with these\nsamples.\n\nAlternatively, you can import the\n[Cloud Code custom sample sample repository](https://github.com/GoogleCloudPlatform/cloud-code-custom-samples-example/)\nto try the custom sample experience. To better understand how custom sample\nrepositories are set up, it is recommended that you try forking the repository\nand modifying its structure and content before importing it. You can do this by\ncreating new samples in the repository or modifying the source code to create\nyour own versions of the Hello World or Kubernetes Custom Sample apps.\n\nBefore you begin\n----------------\n\nMake sure that Git version 2.25.0 or later is installed on your local machine.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nCloud Shell Editor, click **Guide me**:\n\n[Guide me](https://ide.cloud.google.com/?walkthrough_tutorial_id=cloud_code_custom_samples)\n\n*** ** * ** ***\n\nCreating your app from an imported sample\n-----------------------------------------\n\nTo create a new application using a sample from your sample repository:\n\n1. Copy the Git URL of the sample repository that you'd like to use. If you're\n using a Git repository hosted live on your local machine, the `.git` suffix\n is omitted and the URL is of the form `/path/to/repo`.\n\n | **Note:** Using an **HTTPS** Git URL is recommended. To use a SSH URL, you'll need to generate and configure SSH keys. For more information, see the documentation for your Git repository hosting service. For example, [GitHub](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh), [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/), and [GitLab](https://docs.gitlab.com/ee/user/ssh/).\n2. In the Cloud Code status bar, click the active project name.\n\n3. In the Quick Pick menu that appears, select **New Application**.\n\n4. When you're prompted for the type of sample to use, select **Custom\n application**.\n\n5. Click **Import Sample from Repo**.\n\n6. When you're prompted for the URL, enter the Git URL you copied earlier.\n\n The URL in this example uses the HTTPS GitHub format: `https://github.com/username/repo-name.git`.\n\n **Troubleshooting tip:** If you're having trouble with Git authentication,\n check to see that VS Code's built-in Git extension is enabled (search for\n `@builtin git`) and that the `Git: Terminal Authentication` setting in your\n User settings is checked.\n7. To use the latest version of your samples in Cloud Code, click\n refresh\n **Refresh Templates**.\n\n8. Check the terminal window in your IDE to confirm that your repository has been\n cloned successfully.\n\n The repository's default branch is automatically used. To use another branch:\n 1. Edit the branch in use or the repository URL in your `settings.json` file under `cloudcode.customApplications`.\n 2. Click **Custom Application**.\n 3. Click refresh **Refresh**.\n\n If your repository wasn't cloned successfully,\n you can use the Manage Repositories option to update your sample repository\n details with a valid Git URL and/or branch.\n9. From the updated list of samples, select your custom sample.\n\n10. Enter your project name and location.\n\n11. Click **Create New Application**.\n\n Cloud Code creates your app using your chosen sample and opens\n your app for use.\n\nGet Support\n-----------\n\nTo send feedback, report issues on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues), or ask a question on [Stack Overflow](https://stackoverflow.com/questions/ask?tags=cloud-code-vscode)."]]