在 Cloud Code for IntelliJ 中使用 Cloud Source Repositories

通过 Cloud Code,您可以将新项目添加到 Cloud Source Repositories,还可以签出 现有项目。

准备工作

  1. 登录您的 Google Cloud 账号。如果您是 Google Cloud的新用户, 请创建一个账号,以便在 真实场景中评估我们产品的性能。新客户还可获享 $300 赠金,用于 运行、测试和部署工作负载。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

上传源代码

将代码从 Cloud Code 上传到 Cloud Source Repositories:

  1. 打开要添加到 Cloud Source Repositories 的项目。

  2. 依次点击 VCS > 上传到 Cloud Source Repositories 。或者,在 菜单中,依次前往工具 > Google Cloud Code > 上传到 Cloud Source Repositories

  3. 在对话框中,使用相应下拉菜单选择与您的项目关联的 Cloud 项目

  4. 使用下拉菜单选择您的云端代码库

    1. 如果您没有代码库,或者要创建新的代码库,请点击 Create a new cloud repository

      Cloud Code 会打开一个跳转到 Google Cloud 控制台的新浏览器窗口,以便您可以创建新的代码库。

  5. 默认情况下,Cloud Code 会设置远程名称 。您可以在 New Remote Name 字段中输入其他名称。

  6. 点击上传

开发

如需执行提交和推送新更改等其他操作,请依次前往 VCS > VCS Operations Popup

浏览源文件

上传源代码后,要在 Google Cloud 控制台中浏览它们,请执行以下步骤:

  1. Google Cloud 控制台中,选择包含您的源代码的项目。

  2. 在搜索栏中,搜索 Cloud Source Repositories

签出源代码

如需从 Cloud Source Repositories 中签出源代码,请执行以下操作:

  1. 选择 VCS > Get from Version Control 。或者,前往欢迎对话框,然后点击 Get from VSC
  2. Version Control 下拉列表中选择 Google Cloud ,然后点击 Clone
  3. Clone from Google Cloud 对话框中,选择与您的项目关联的 Cloud 项目
  4. 选择您的云端代码库
  5. 选择父级目录
  6. 输入目录名称
  7. 点击克隆

您也可以从欢迎 屏幕中签出,方法是选择 Get from Version Control ,然后从“Version Control”下拉列表中选择 Google Cloud 。此时将显示 Clone from Google Cloud 对话框。

获取支持

如需在 IntelliJ IDE 中提交反馈或报告问题,请依次前往 工具 > Cloud Code > 帮助 / 简介 > 提交 反馈或报告问题 ,在 GitHub 上报告问题。