Score:0

How to recover keys

pk flag

I recently did a fresh installation of Ubuntu 20.04 on my workstation. I made a complete backup of my home directory, and have been pulling out the bits that I need. I had set up a signing key for my git commits, and failed to export it before the reinstallation. Of course, the file are still in ~/.gnupg. I'm not exactly sure of the structure in this directory, such as where the public and private keys are, and if just moving them over is sufficient. I'm worried about doing something stupid and messing up my existing installation.

Score:2
gb flag

First of all copying over ~/.gnupg to a new machine should be fine and working. See Moving/Copying your PGP Keys as reference.

Accordingly to the git documentation Git - Signing Your Work you should be able to see your existing key via:

gpg --list-keys

Your existing key should be listed there.

If it is check git repo or global configuration if and what key is currently set:

  • for "repo only" configuration (you have to be within your repo directory):

    git config user.signingkey
    
  • global:

    git config --global user.signingkey
    

If key from gpg --list-keys command and git config match you should be fine.

If git user.signingkey config is empty set it with

git config --global user.signingkey 0A46826A

where "0A46826A" should be your existing key hash.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.