Install AWS patterns globally to be prevented to be checked in to git:
Check the list of secrets git secrets will scan for:
It should return something like:
Now every time you run git init or git clone, your hooks will be copied into the .git directory of your freshly created repo. If you don’t want to set the template globally, you can use it as needed with git init --template ’~/.git-template’.
That covers new repo creation, and cloning, but we haven’t addressed the problem of existing repos that weren’t created with the template. Here we have a couple options:
git init is a non-destructive operation, so feel free to run it in existing repos. It’s safe, and will retroactively apply the template you specify.
OR
If you want to go “all in” and ensure that every repo has the proper hooks, here’s a script that will recursively walk a directory, such as ~/Projects and run git secrets --install in all repos.
# stash current state
git stash save "Worked on get identities/{identityId}"
# apply current stage (e.g. in other branch) but keep stash
git stash add
# apply current state and delete stash
git stash pop