# sign commit with pgp

Make sure you setup A PGP key on your local machine. See [this article](https://til.yulrizka.com/unix/encryption-with-gpg) to set it up

Make sure you have a key that matched the email that you used for the commit. (eg: `username@users.github.com`

add `-S` flag when you want to sign the commit

```
$ git commit -S -m "your commit message"
# Creates a signed commit
```

or add enable it by default

`Tell git which key to use`

```
git config --global user.signingkey ABC123
```

```
git config --global commit.gpgsign true
```

If you are having issue, `GIT_TRACE=1` with your git comment

```
GIT_TRACE=1 git commit -S -m "your commit message"
```
