Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. EXISTS="`git config --global --list | sed -n "/.*signingkey.*/p"`"
  4.  
  5. if [ -z $EXISTS ]
  6. then
  7. echo "Woops ! It seems you dont have your git signed. Looking for an existing GPG key..."
  8.  
  9. SIGNING_KEY="`gpg --list-keys | sed -n '3p' | sed "s/.*\///" | sed "s/ .*//"`"
  10.  
  11. if ! [ -z "$SIGNING_KEY" ]; then
  12. echo "GPG Key found ! Using: $SIGNING_KEY"
  13.  
  14. git config --global user.signingkey "$SIGNING_KEY"
  15.  
  16. echo "Configured your global user with the key :)"
  17.  
  18. EXISTS="exists"
  19. else
  20. echo "GPG Key not found :( Create one with: gpg --gen-key"
  21. fi
  22. fi
  23.  
  24. if ! [ -z $EXISTS ]; then
  25. git commit -S
  26. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement