Skip to content

Instantly share code, notes, and snippets.

@gtklocker
Created April 13, 2016 11:36
Show Gist options
  • Select an option

  • Save gtklocker/a81d8bc62ac727272fe7cefc3e501405 to your computer and use it in GitHub Desktop.

Select an option

Save gtklocker/a81d8bc62ac727272fe7cefc3e501405 to your computer and use it in GitHub Desktop.
#!/bin/bash
execgit() {
exec git "$@"
}
if [ "`git rev-parse --is-inside-work-tree`" != "true" ]; then
execgit
fi
dotGitDirectory="`git rev-parse --git-dir`"
if [ "`find -L "$dotGitDirectory" -type f -perm +u+x,g+x,o+x ! -regex '.*\.sample$'|wc -l`" -gt "0" ]; then
echo "INSECURE: Check your git hooks, someone may be attacking you."
echo "Exiting."
exit 1
else
execgit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment