# GPG

How to generate and use GPG Keys.

# Generate Key

1. gpg --full-generate-key
2. Select defaults or the required option if you have them
3. Select an expiration date
4. Enter your personal information (it needs to be consistent with your account info)
5. Use a secure passphrase

#### Key can be listed with:

```
gpg --list-secret-keys --keyid-format=long
```

#### Key can exported with:

```
gpg --armor --export <key>
```

#### Screenshots:

[![image.png](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/scaled-1680-/image.png)](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/image.png)

[![FyAimage.png](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/scaled-1680-/fyaimage.png)](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/fyaimage.png)

# Add Keys to Github/Gitea

#### [Github](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)

1. [Settings](https://github.com/settings/profile)
2. [SSH and GPG keys](https://github.com/settings/keys)
3. New GPG Key
4. Paste in the public key block
5. Add GPG Key
6. Turn on Vigilant mode

---

#### Gitea

1. [Settings](https://gitea.hopeless-cloud.xyz/user/settings)
2. [SSH / GPG Keys](https://gitea.hopeless-cloud.xyz/user/settings/keys)
3. Add Key
4. Paste in the public key block
5. Add Key
6. Verify

#### Screenshot:

[![vDXimage.png](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/scaled-1680-/vdximage.png)](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/vdximage.png)

# Telling Git about your Key

```
gpg --list-secret-keys --keyid-format=long
```

```
git config --global user.signingkey <key>
```

#### Screenshot:

[![Mxvimage.png](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/scaled-1680-/mxvimage.png)](https://bookstack.hopeless-cloud.xyz/uploads/images/gallery/2024-02/mxvimage.png)