通过 Cloud Code,您可以将新项目添加到 Cloud Source Repositories,还可以签出现有项目。
准备工作
- 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.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
上传源代码
将代码从 Cloud Code 上传到 Cloud Source Repositories:
打开要添加到 Cloud Source Repositories 的项目。
依次点击 VCS > Upload to Cloud Source Repositories。或者,在菜单中依次选择 Tools > Google Cloud Code > Upload to Cloud Source Repositories。
在对话框中,使用相应下拉菜单选择与您的项目关联的 Cloud 项目。
使用下拉菜单选择您的云端代码库。
如果您没有代码库,或者要创建新的代码库,请点击 Create a new cloud repository。
Cloud Code 会在新的浏览器窗口中打开 Google Cloud 控制台,以便您创建新的代码库。
默认情况下,Cloud Code 会设置远程名称。您可以在 New Remote Name 字段中输入其他名称。
点击上传。
开发
如需执行其他操作(例如提交和推送新更改),请前往 VCS > VCS 操作弹出式窗口。
浏览源文件
上传源代码后,要在 Google Cloud 控制台中浏览它们,请执行以下步骤:
在 Google Cloud 控制台中,选择包含您的源代码的项目。
在搜索栏中,搜索
Cloud Source Repositories
。
查看源代码
如需从 Cloud Source Repositories 中签出源代码,请执行以下操作:
- 依次选择 VCS > Get from Version Control。或者,前往欢迎对话框,然后点击 Get from VSC。
- 从 Version Control 下拉列表中选择 Google Cloud,然后点击 Clone。
- 在 Clone from Google Cloud 对话框中,选择与您的项目关联的 Cloud 项目。
- 选择您的云端代码库。
- 选择父级目录。
- 输入目录名称。
- 点击克隆。
您也可以从 Welcome 屏幕中签出,方法是选择 Get from Version Control,然后从“Version Control”下拉列表中选择 Google Cloud。此时将显示 Clone from Google Cloud 对话框。