在 Cloud Code for VS Code 中,使用自訂範例建立新應用程式
範例存放區是 Git 存放區,內含可用於開發應用程式的自訂範例。設定範例存放區 (或讓系統為您設定) 後,您就可以開始使用這些範例建立應用程式。
或者,您也可以匯入 Cloud Code 自訂範例樣本存放區,體驗自訂範例。如要進一步瞭解如何設定自訂範例存放區,建議您先試著分支存放區,然後修改其結構和內容,再匯入。您可以在存放區中建立新的範例,或是修改原始碼,以建立您自己的 Hello World 或 Kubernetes 自訂範例應用程式版本。
事前準備
確認本機已安裝 Git 2.25.0 以上版本。
從匯入的範例建立應用程式
如何使用範例存放區中的範例建立新應用程式:
複製要使用的範例存放區的 Git 網址。如果您使用的是本機電腦上直接代管的 Git 存放區,系統會省略 .git
後置字串,網址會採用 /path/to/repo
的格式。
在 Cloud Code 狀態列中,按一下目前專案名稱。

在隨即顯示的「快速挑選」選單中,選取「New Application」。
系統提示您使用哪種範例時,請選取「自訂應用程式」。
按一下「從存放區匯入範例」。
系統提示輸入網址時,請輸入先前複製的 Git 網址。
本例中的網址使用 HTTPS GitHub 格式:https://github.com/username/repo-name.git
。
疑難排解提示:如果您在 Git 驗證方面遇到問題,請確認 VS Code 內建的 Git 擴充功能是否已啟用 (搜尋 @builtin git
),以及使用者設定中的 Git: Terminal Authentication
設定是否已勾選。
如要在 Cloud Code 中使用最新版本的範例,請按一下「重新整理」「重新整理範本」。
檢查 IDE 中的終端機視窗,確認已成功複製存放區。
系統會自動使用存放區的預設分支。如要使用其他分支,請按照下列步驟操作:
- 在
cloudcode.customApplications
下方的 settings.json
檔案中,編輯目前使用的分支或存放區網址。
- 按一下「Custom Application」。
- 按一下「重新整理」。
如果存放區複製作業未成功,您可以使用「管理存放區」選項,使用有效的 Git 網址和/或分支更新範例存放區詳細資料。
從更新後的樣本清單中選取自訂樣本。
輸入專案名稱和位置。
按一下「Create New Application」(建立新應用程式)。
Cloud Code 會使用您選擇的範例建立應用程式,並開啟應用程式供您使用。
取得支援
如要提供意見回饋,請前往
GitHub 回報問題,或在
Stack Overflow 上提問。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-11 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-11 (世界標準時間)。"],[[["A sample repository in Git contains custom samples for developing applications, and can be set up or imported for use."],["You 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."],["To create a new application from a sample repository, you need the Git URL of the repository, which should preferably be an HTTPS URL."],["After 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."],["The 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."]]],[]]