gadenbuie / garrickadenbuie-com

My personal website
https://www.garrickadenbuie.com
17 stars 4 forks source link

Signed commits with RStudio #88

Closed gadenbuie closed 3 years ago

gadenbuie commented 3 years ago

See rstudio issue 1865

https://grrrck.notion.site/keybase-gpg-setup-commit-signing-35333d2eb5e9492fa69846a9184fd587

I just went through setting up signed commits, in my case using a keybase GPG key. With a few additional configuration steps, it works well with RStudio.

  1. Set your git global config to sign commits using your default key

    git config --global user.signingkey <Key ID>
    git config --global commit.gpgsign true
  2. Configure gpg to use an agent for providing your password to unlock your key (I also set the default key here to make life easier)

    # ~/.gnupg/gpg.conf
    use-agent
    default-key <Key ID>
  3. Configure gpg-agent to remember your key's password for the day (8 hours or 28,800 seconds)

    # ~/.gnupg/gpg-agent.conf
    default-cache-ttl 28800
    max-cache-ttl 28800

    You may need to restart gpg-agent at this point.

    gpg-agent --daemon
    
    # if it prints a message that gpg-agent is already running...
    kill-all gpg-agent
    gpg-agent --daemon
  4. At this point, any git commit will automatically be signed using your default key. The first commit of the day will require you to enter your password, which does mean that the RStudio Git UI won't be able to sign the first commit unless you've asked gpg to sign something for you.

    To get around this, you can unlock your gpg key by signing anything at the start of your work day or whenever the 8 hour time limit runs out.

    echo "open sesame" | gpg -s > /dev/null
    # prompt for password 
gadenbuie commented 3 years ago

closed with #89