> For the complete documentation index, see [llms.txt](https://docs.junyangz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.junyangz.com/note/gpg-tutorial.md).

# GPG-Note

## Import/export key

```bash
gpg --list-keys
gpg --armor --output <public-key-file> --export <ID>
gpg --import <public-key-file>
gpg --keyserver hkp://keys.gnupg.net --search-keys <ID>
```

```bash
gpg --armor --output <private-key-file> --export-secret-keys <ID>
gpg --allow-secret-key-import --import <private-key-file>
gpg --list-secret-keys --keyid-format LONG
```

## Edit passphrase

```bash
gpg --edit-key <ID>
passwd
```

## Git setup gpg sign

> Github add gpg public key

```bash
git config --global commit.gpgsign true
git config --global gpg.program gpg
```

## gpg and git for MAC

```bash
# import keys
gpg2 --list-secret-keys
git config --global gpg.program /usr/local/bin/gpg2
git config --global user.signingkey 987BACA4 
git config --global commit.gpgsign true 
```

Refer [gists](https://gist.github.com/danieleggert/b029d44d4a54b328c0bac65d46ba4c65)
