GPG signing commits

Download git eBook

Example

  1. Determine your key ID

    gpg --list-secret-keys --keyid-format LONG
    
    /Users/davidcondrey/.gnupg/secring.gpg
    --------------------------------------
    sec   2048R/YOUR-16-DIGIT-KEY-ID YYYY-MM-DD [expires: YYYY-MM-DD]
    

    Your ID is a alphanumeric 16-digit code following the first forward-slash.

  2. Define your key ID in your git config

    git config --global user.signingkey YOUR-16-DIGIT-KEY-ID
    
  3. As of version 1.7.9, git commit accepts the -S option to attach a signature to your commits. Using this option will prompt for your GPG passphrase and will add your signature to the commit log.

    git commit -S -m "Your commit message"
    

Stats

Contributors: 1
2016-08-11
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook