

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 建立生命週期組態，將儲存庫複製到程式碼編輯器應用程式
<a name="code-editor-use-lifecycle-configurations-repositories"></a>

本節說明如何複製儲存庫，並建立已連接生命週期組態的程式碼編輯器應用程式。

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. 建立已連接生命週期組態的程式碼編輯器應用程式。

   ```
   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}}"
   ```

   如需可用程式碼編輯器映像 ARN 的詳細資訊，請參閱 [程式碼編輯器應用程式執行個體和映像](code-editor-use-instances.md)。