Can Sagemaker Git Repositories use ssh secrets (no name and password)?

0

Can Sagemaker Git Repositories use ssh secrets (no name and password)?

1 Answer
0
Accepted Answer

Yes, Sagemaker can use SSH for private repos. There are multiple options on how to connect to a repo in Sagemaker.

** Option 1**: Using SSH to work with a private repo You can follow the same steps you do in your local machine to connect to a private repo through SSH, steps to follow:

  1. Open Terminal and type ssh-keygen to create an SSH key in your Amazon Sagemaker instance.
  2. Add the public key to your Git account (Github or Gitlab)
  3. Get the SSH url of your repo and git clone

Option 2: Using AWS Secret Manager You can follow the steps in AWS official documentation here.

Option 3: Using GitHub with Personal Access Tokens Recommended

Let’s assume you have already generated an Access Tokens through the GitHub’s Settings / Developer Settings / Personal Access Tokens page.

You can just simply go ahead and clone the repository using Studio UI. When it asks your username and password, you can provide your GitHub username and the Personal Access Token. If you want to cache your credentials avoiding to type it every time when you’re interacting with the GitHub server, you can cache or store it on your home folder with the following command issued in the Terminal:

$ git config --global git credential.helper [cache|store]

If you choose to store your credentials, it will be written to the ~/.git-credentials file located in your home folder. The “cache” helper stores the credential in-memory only and never lands on disk. It also accepts the --timeout <seconds> option, which changes the amount of time its daemon is kept running (the default is “900”, or 15 minutes)

Before you make your first commit, you still need to configure the git client to use your identity when we’re checking in some new code into the repository. You need to run the following two commands from the terminal:

$ git config --global user.email “user@email.com”
$ git config --global user.name “User Name”

Sagemaker Studio is fully integrated with git and you can do it through the UI.

AWS
Zmnako
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions