sagemaker-distribution icon indicating copy to clipboard operation
sagemaker-distribution copied to clipboard

Configure git with AWS CodeCommit credential helper

Open giuseppeporcelli opened this issue 2 years ago • 2 comments

This would allow working with AWS CodeCommit with temporary IAM credentials available in JupyterLab and CodeEditor when using the SageMaker Distribution in SageMaker Studio.

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true

giuseppeporcelli avatar Dec 06 '23 18:12 giuseppeporcelli

Hi @giuseppeporcelli can you provide us with any verification steps? (for my local docker image)

balajisankar15 avatar Dec 12 '23 19:12 balajisankar15

We have same problem where codeeditor isnt able to communicate with codecommit out of the box. Similar to the git config commands proposed by @giuseppeporcelli , we are using LCC to set the gitconfig in the home directory. Email and User are resolved by fetching tags on the execution role but that part is probably not generally viable so I excluded those parts.

echo "Email: $USER_EMAIL"
echo "User: $USER_NAME"

GIT_CONFIG_PATH="$HOME/.gitconfig"
cat > $GIT_CONFIG_PATH << GITCONFIGEOF
[user]
       name = $USER_NAME
       email = $USER_EMAIL
[credential]
       helper = !aws codecommit credential-helper \$@
       UseHttpPath = true
GITCONFIGEOF

petersaltin avatar Feb 22 '24 17:02 petersaltin

Given that AWS is deprecating Code commit, is this request necessary? Closing this issue. Feel free to reopen if this is still required. Ref: https://aws.amazon.com/blogs/devops/how-to-migrate-your-aws-codecommit-repository-to-another-git-provider/

balajisankar15 avatar Dec 10 '24 21:12 balajisankar15