Attach a Git Repository from the Amazon CLI - Amazon SageMaker
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Attach a Git Repository from the Amazon CLI

Important

As of November 30, 2023, the previous Amazon SageMaker Studio experience is now named Amazon SageMaker Studio Classic. The following section is specific to using the Studio Classic application. For information about using the updated Studio experience, see Amazon SageMaker Studio.

The following topic shows how to attach a Git repository URL using the Amazon CLI, so that Amazon SageMaker Studio Classic automatically suggests it for cloning. After you attach the Git repository URL, you can clone it by following the steps in Clone a Git Repository in SageMaker Studio Classic.

Prerequisites

Before you begin, complete the following prerequisites:

Attach the Git repo to a domain or user profile

Git repo URLs associated at the domain level are inherited by all users. However, Git repo URLs that are associated at the user profile level are scoped to a specific user. You can attach multiple Git repo URLs to a domain or user profile by passing a list of repository URLs.

The following sections show how to attach a Git repo URL to your domain and user profile.

Attach to a domain

The following command attaches a Git repo URL to an existing domain.

aws sagemaker update-domain --region region --domain-id domain-id \ --default-user-settings JupyterServerAppSettings={CodeRepositories=[{RepositoryUrl="repository"}]}

Attach to a user profile

The following shows how to attach a Git repo URL to an existing user profile.

aws sagemaker update-user-profile --domain-id domain-id --user-profile-name user-name\ --user-settings JupyterServerAppSettings={CodeRepositories=[{RepositoryUrl="repository"}]}