Last active
April 13, 2020 08:20
-
-
Save jpignata/b13cf23e29e7b21da25c33d0b842464e to your computer and use it in GitHub Desktop.
Install git-secrets on all repos in home directory
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
#!/usr/bin/env bash | |
# Install git-secrets template for new and cloned repos | |
if [ ! -d "$HOME/.git-templates/git-secrets" ] | |
then | |
echo "Installing git-secret globally" | |
git secrets --register-aws --global | |
git secrets --install $HOME/.git-templates/git-secrets | |
git config --global init.templateDir $HOME/.git-templates/git-secrets | |
fi | |
# Find and install hook on all existing repos in home directory | |
for dir in $(find $HOME -type d -name '.git' 2>/dev/null); | |
do | |
echo "Installing git-secret to $(dirname $dir)" | |
cd $dir && \ | |
git secrets --install --force 1>/dev/null && \ | |
git secrets --register-aws | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment