Last active
September 16, 2015 19:21
-
-
Save hryamzik/3fad9a3c0a0c2d5d4664 to your computer and use it in GitHub Desktop.
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 | |
repo="$(git config --get remote.origin.url|sed -E 's/http(s)?:[/]{2}([^/]+)[/]/git@\2:/')" | |
test -n "$repo" || repo="$PWD" | |
if ! security find-generic-password -gw -s "$repo" -a "ansible-vault" -D "ansible vault" | |
then | |
echo "Enter password for $repo:" 1>&2 | |
read pass | |
security add-generic-password -a "ansible-vault" -s "$repo" -w "$pass" -D "ansible vault" -T "" | |
echo $pass | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment