Skip to content

Instantly share code, notes, and snippets.

@eamonnfaherty
Last active December 11, 2018 21:22
Show Gist options
  • Save eamonnfaherty/3399458cb7f5569567bd414057e0dde7 to your computer and use it in GitHub Desktop.
Save eamonnfaherty/3399458cb7f5569567bd414057e0dde7 to your computer and use it in GitHub Desktop.
delete your internet password for AWS CodeCommit repos
#!/bin/sh
# guide on how to add global git hooks:
# https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook
# add this as a pre-push git hook
# .git/hooks/pre-push
remote="$1"
url="$2"
REGION=$(git remote -v | grep codeco | awk -F\/ '{print $3}' | awk -F. '{print $2}' | uniq)
security delete-internet-password -l "git-codecommit.$REGION.amazonaws.com" ~/Library/Keychains/login.keychain 1>/dev/null 2>/dev/null || true
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment