Skip to content

Instantly share code, notes, and snippets.

@jplomas
Created April 12, 2022 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jplomas/879e27ce5b5d9d86f31d000360aa467d to your computer and use it in GitHub Desktop.
Save jplomas/879e27ce5b5d9d86f31d000360aa467d to your computer and use it in GitHub Desktop.
#!/bin/bash
inRepo=`git rev-parse --is-inside-work-tree 2> /dev/null;`
echo $inRepo
if [[ $inRepo != "true" ]]
then
echo 'Not in a repo'
exit 1
fi
userEmail=`git config --get user.email`
signingKey=`git config --get user.signingkey`
# check for jp.lomas@gmail.com
if [[ $userEmail = "jp.lomas@gmail.com" ]];
then
echo "gets gmail"
echo "expects B8AB109A92D4C85E"
if [[ $signingKey = "B8AB109A92D4C85E" ]];
then
echo "found okay"
exit 0
else
echo "not found"
exit 1
fi
fi
# check for jp@theqrl.org
if [[ $userEmail = "jp@theqrl.org" ]];
then
echo "gets theqrl"
echo "expects 49C980CD2D8D21F4"
if [[ $signingKey = "49C980CD2D8D21F4" ]];
then
echo "found okay"
exit 0
else
echo "not found"
exit 1
fi
fi
## errors...
if [[ $signingKey = "" ]];
then
echo "No signing key found. Check global gitconfig"
exit 1
else
echo "Unknown signing key found. Check .githook.sh"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment