Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- EXISTS="`git config --global --list | sed -n "/.*signingkey.*/p"`"
- if [ -z $EXISTS ]
- then
- echo "Woops ! It seems you dont have your git signed. Looking for an existing GPG key..."
- SIGNING_KEY="`gpg --list-keys | sed -n '3p' | sed "s/.*\///" | sed "s/ .*//"`"
- if ! [ -z "$SIGNING_KEY" ]; then
- echo "GPG Key found ! Using: $SIGNING_KEY"
- git config --global user.signingkey "$SIGNING_KEY"
- echo "Configured your global user with the key :)"
- EXISTS="exists"
- else
- echo "GPG Key not found :( Create one with: gpg --gen-key"
- fi
- fi
- if ! [ -z $EXISTS ]; then
- git commit -S
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement