在 Cloud Shell 中浏览文件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本主题描述如何使用 Cloud Shell 浏览文件。
首次在 Cloud Shell 中打开代码库
在 Google Cloud Console 中,打开 Cloud Source Repositories。
打开 Cloud Source Repositories。
点击代码库的名称。
此时将会打开一个页面,上面显示代码库的内容。
点击 Edit code。
此时会打开一个包含 Cloud Shell 环境的新浏览器标签。还会提示您确认是否要将代码库克隆到 Cloud Shell 中。
点击继续。
此时会打开 Cloud Shell 环境,其中包含克隆的代码库。
默认情况下,代码库的位置为 ~/[repository name]
。例如 ~/hello-world
。
使用 Cloud Shell 打开现有代码库
如果您已将代码库克隆到 Cloud Shell 环境中,请按照上一部分中的步骤操作。准备好 Cloud Shell 环境后,系统会提示您从以下选项之一中进行选择:
- 导航到该目录。要将目录自动更改为包含您的代码库的目录,请选择此选项。例如
~/hello-world
。
- 导航到该目录并运行
git pull
。要将目录自动更改为包含您的代码库的目录,并将最新版本的代码库拉到 Cloud Shell 环境,请选择此选项。
- 使用
git clone
命令克隆新副本。要在 Cloud Shell 环境中创建一个包含代码库的新文件夹,请选择此选项。新文件夹名称与代码库名称一致,并附加一个数字。例如,代码库的第二个副本 hello-world
的名称为 ~/hello-world-2
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-02-17。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"很难理解"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"信息或示例代码不正确"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"没有我需要的信息/示例"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]