Skip to content

Commit 6eace60

Browse files
wsmarshccojocar
authored andcommitted
Update git-secrets to include prohibited regular expressions from a .gitprohibited file
1 parent f7b1254 commit 6eace60

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ like Ubuntu (BSD vs GNU).
445445
You can add prohibited regular expression patterns to your git config using
446446
``git secrets --add <pattern>``.
447447

448+
You can also add prohibited regular expressions patterns to a
449+
``.gitprohibited`` file located in the repository's root directory. Lines starting
450+
with ``#`` are skipped (comment line) and empty lines are also skipped.
448451

449452
Ignoring false positives
450453
------------------------

git-secrets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ prepare_commit_msg_hook* prepare-commit-msg hook (internal only)"
5252

5353
load_patterns() {
5454
git config --get-all secrets.patterns
55+
local gitprohibited="$(git rev-parse --show-toplevel)/.gitprohibited"
56+
if [ -e "$gitprohibited" ]; then
57+
cat $gitprohibited | awk 'NF && $1!~/^#/'
58+
fi
5559
# Execute each provider and use their output to build up patterns
5660
git config --get-all secrets.providers | while read -r cmd; do
5761
# Only split words on '\n\t ' and strip "\r" from the output to account

0 commit comments

Comments
 (0)