3

Is there a way to recover a deleted GPG key on GitHub? My old key expired, I generated a new one and delete the old one. Now, all my old commits are unverified.

Comments
  • 1
    Did you take a backup?
  • 0
  • 2
    @latisfeire you're pretty fucked at this point.

    If you are part of an enterprise account you MAY be able to open a support ticket, but I doubt it.
  • 0
    Yes, you can recover if you still have still the `/.gnupg/private-keys-v1.d` directory, which will contain two “hashfile" named files with the `.key` file extension for each private key you need to restore. If you're on a new computer, run `gpg` once to create a new `.gnupg` directory (or create it manually). Then copy the two files to the new `private-keys-v1.d` directory. You have restored the secret key material. Now you need to get a copy of your public key. They should be on the key servers (`gpg --auto-key-locate keyserver --search-keys your_email_net` and `gpg --auto-key-locate keyserver --recv-keys HASHCODE`) or if you have sent them to other places, get a copy and `gpg --import` them. Then better restart the gpg-agent (`gpgconf --kill gpg-agent`).

    If you don't have the `private-keys-v1.d` directory, then you would need to brute force by finding these four prime numbers.
  • 0
    I have the same problem, and also I have the folder

    private-keys-v1.d, how can I restore my gpg key
Add Comment