Created
May 4, 2019 14:43
-
-
Save aheissenberger/151c82725107ebb34e343f497aebc8a6 to your computer and use it in GitHub Desktop.
Wrapper for AWS CodeCommit git credential helper to fix problem with MacOS keystore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SETUP: add to local git config: | |
# git config --local credential.helper '!~/bin/awsCredentialHelperOSX AWS_PROFILE' | |
# replace AWS_PROFILE with the relevant profile name, replace "~/bin/" with path to this file | |
aws_profile="$1" | |
shift | |
# get aws_access_key_id for aws_profile | |
aws_access_key_id=$(sed -n '/^[ \t]*\[${aws_profile}\]/,/\[/s/^[ \t]*aws_access_key_id[ \t]*=[ \t]*//p' ~/.aws/credentials) | |
security -q delete-internet-password -a "${aws_access_key_id}" >/dev/null 2>&1 | |
/usr/local/bin/aws --profile "${aws_profile}" codecommit credential-helper $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment