

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

# 创建生命周期配置，将软件源克隆到 Code Editor 应用程序中
<a name="code-editor-use-lifecycle-configurations-repositories"></a>

本节将介绍如何克隆一个存储库，并创建一个附加生命周期配置的 Code Editor 应用程序。

1. 在本地计算机上，创建一个名为 `my-script.sh` 的文件，内容如下：

   ```
   #!/bin/bash
   set -eux
   ```

1. 在生命周期配置脚本中选择克隆存储库。

   ```
   export REPOSITORY_URL="{{https://github.com/aws-samples/sagemaker-studio-lifecycle-config-examples.git}}"
   git -C {{/home/sagemaker-user}} clone $REPOSITORY_URL
   ```

1. 最终确定脚本后，创建并附加生命周期配置。有关更多信息，请参阅 [在 Studio 中创建并附加生命周期配置](code-editor-use-lifecycle-configurations-studio-create.md)。

1. 创建 Code Editor 应用程序，并附加生命周期配置。

   ```
   aws sagemaker create-app \
   --domain-id {{domain-id}} \
   --space-name {{space-name}} \
   --app-type {{CodeEditor}} \
   --app-name {{default}} \
   --resource-spec "SageMakerImageArn=arn:aws:sagemaker:{{region}}:{{image-account-id}}:image/{{sagemaker-distribution-cpu}},LifecycleConfigArn=arn:aws:sagemaker:{{region}}:{{user-account-id}}:studio-lifecycle-config/{{my-code-editor-lcc}},InstanceType={{ml.t3.large}}"
   ```

   有关可用 Code Editor 映像 ARN 的更多信息，请参阅 [代码编辑器应用程序实例和映像](code-editor-use-instances.md)。