

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在笔记本实例中使用 Git 存储库
<a name="git-nbi-use"></a>

当您打开关联有 Git 存储库的笔记本实例时，它会在默认存储库中打开，默认存储库直接安装在笔记本实例的 `/home/ec2-user/SageMaker` 下。您可以打开和创建笔记本，也可以在笔记本单元格中手动运行 Git 命令。例如：

```
!git pull origin master
```

要打开任何额外的存储库，请从文件夹向上导航一级。额外的存储库也作为目录安装在 `/home/ec2-user/SageMaker` 下。

如果您使用 JupyterLab 接口打开笔记本实例，则会安装 jupyter-git 扩展并可供使用。[有关 jupyter-git 扩展名的信息，请参阅 jupyterlab-git。 JupyterLab https://github.com/jupyterlab/](https://github.com/jupyterlab/jupyterlab-git)

当你在中打开笔记本实例时 JupyterLab，你会在左侧菜单中看到与之关联的 git 存储库：

![中的示例文件浏览器 JupyterLab。](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/git-notebook.png)


您可以使用 jupyter-git 扩展来直观管理 git，而不是使用命令行：

![中的 jupyter-git 扩展的示例。 JupyterLab](http://docs.aws.amazon.com/zh_cn/sagemaker/latest/dg/images/jupyterlab-git.png)
