在 Team Explorer 中,您可以按一下 [Clone or Create] (複製或建立) 連結,以開啟「Clone Google Cloud Source repository」(複製 Google Cloud Source 存放區) 對話方塊,並建立新存放區或將現有存放區複製到您的本機電腦。
建立新的存放區:
按一下 [Clone or Create] (複製或建立) 連結。
在「Project」下拉式選單中選取專案。 Google Cloud
按一下「新增」。
「Add a new repository」(新增存放區) 對話方塊會隨即顯示。
輸入存放區名稱。
點選 [OK] (確定)。
如何複製現有存放區:
按一下 [Clone or Create] (複製或建立) 連結。
在「Project」下拉式選單中選取專案。 Google Cloud
在「Repository」(存放區) 下拉式選單中選取所需的存放區。
在 [Clone to] (複製到) 欄位中,輸入您要將原始碼複製到哪個目標位置。
或者,您也可以按一下 [Browse] (瀏覽) 以開啟檔案瀏覽器,瀏覽至所需位置。
按一下 [Clone] (複製)。
您的原始碼現在已存放在指定的位置,而您複製的存放區則會顯示在 Team Explorer 中。
執行 Git 工作
您可以在 Visual Studio 中執行所有 Git 工作。如要進一步瞭解這些工作,請參閱 Git 參考指南。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Managing Cloud Source Repositories\n\n| **Beta**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis document describes how to manage Cloud Source Repositories from\nwithin Visual Studio.\n\nBefore you begin\n----------------\n\n- [Enable access to Cloud Source Repositories](https://console.cloud.google.com/marketplace/details/google/sourcerepo.googleapis.com)\n for your project.\n\n - If you have more than 1 project, select the correct project from the drop-down menu in the title bar.\n- Install [Git for Windows](https://git-scm.com/download/win) if you have not\n done so already.\n\n- Verify that you have\n [Git Credential Manager for Windows](https://github.com/Microsoft/Git-Credential-Manager-for-Windows)\n installed by running the following command in your local terminal:\n\n git credential-manager version\n\nAccess Cloud Source Repositories\n--------------------------------\n\nTo access Cloud Source Repositories, select\n**Team** \\\u003e **Manage Connections**.\n\nA list of your repositories displays in the Team Explorer.\n\nFor first-time users, this list will be empty until you clone a repository.\n\nCreate or clone a repository\n----------------------------\n\nIn Team Explorer, you can click the **Clone or Create** link to open the\n**Clone Google Cloud Source repository** dialog and create a new repository or\nclone an existing one to your local machine.\n\nTo create a new repository:\n\n1. Click the **Clone or Create** link.\n\n2. Select a Google Cloud project in the **Project** drop-down menu.\n\n3. Click **Add new**.\n\n The **Add a new repository** dialog displays.\n4. Enter a **Repository Name**.\n\n5. Click **OK**.\n\nTo clone an existing repository:\n\n1. Click the **Clone or Create** link.\n\n2. Select a Google Cloud project in the **Project** drop-down menu.\n\n3. Select a repository in the **Repository** drop-down menu.\n\n4. Enter the location where you want to clone the source code to in the\n **Clone to** field.\n\n 1. Or, you can click **Browse** to open the file explorer and navigate to the location.\n5. Click **Clone**.\n\n Your source code is now in the specified location, and the cloned repository\n displays in Team Explorer.\n\nPerforming Git tasks\n--------------------\n\n- You can perform all git tasks from within Visual Studio. For more information\n on these tasks, refer to the\n [Git reference guide](https://git-scm.com/book/it/v2/Git-in-Other-Environments-Git-in-Visual-Studio).\n\n- You can also execute these git commands from a shell."]]