Skip to content

Commit 9ac0b03

Browse files
authored
Additional tweaks
1 parent 64d6b81 commit 9ac0b03

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

practices/guides/commit-signing.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,19 @@
3636

3737
1. Pick `RSA and RSA`, or `RSA (sign only)` (there is no elliptic curve cryptography (ECC) support at the time of writing)
3838
1. `keysize` = `4096` bits (the minimum accepted for GitHub)
39+
1. Select a key expiry time (personal choice)
3940
1. `Real name` = Your GitHub handle
4041
1. `Email address` = Your GitHub account email [listed on your GitHub profile](https://github.com/settings/emails) (you can use the privacy *@users.noreply.github.com* email address): `Settings` -> `Emails` -> `Keep my email addresses private`)
4142

4243
> If you go for the private email option, consider enabling `Block command line pushes that expose my email`.
44+
4345
1. Avoid adding a comment (this *may* prevent git from auto-selecting a key - see Troubleshooting section below)
4446
1. Define a passphrase for the key
4547

46-
1. Check the key was made successfully:
47-
48-
```bash
49-
gpg -k
50-
```
51-
5248
1. Export the PGP PUBLIC KEY (to your clipboard):
5349

5450
```bash
51+
gpg -k # This should list the new key
5552
gpg --armor --export ${my_email_address} | pbcopy
5653
```
5754

@@ -76,7 +73,7 @@
7673
### Windows
7774

7875
1. Install [Git for Windows](https://git-scm.com/download/win) (which includes Bash and GnuPG)
79-
1. Right-click on the Desktop -> `Open Git Bash here`
76+
1. Open `Git Bash`
8077
1. Create a new GPG key:
8178

8279
```bash
@@ -85,16 +82,19 @@
8582

8683
1. Pick `RSA and RSA`, or `RSA (sign only)` (there is no elliptic curve cryptography (ECC) support at the time of writing)
8784
1. `keysize` = `4096` bits (the minimum accepted for GitHub)
85+
1. Select a key expiry time (personal choice)
8886
1. `Real name` = Your GitHub handle
8987
1. `Email address` = Your GitHub account email [listed on your GitHub profile](https://github.com/settings/emails) (you can use the privacy *@users.noreply.github.com* email address): `Settings` -> `Emails` -> `Keep my email addresses private`)
9088

9189
> If you go for the private email option, consider enabling `Block command line pushes that expose my email`.
90+
9291
1. Avoid adding a comment (this *may* prevent git from auto-selecting a key - see Troubleshooting section below)
9392
1. Define a passphrase for the key
9493

9594
1. Export the PGP PUBLIC KEY (to your clipboard):
9695

9796
```bash
97+
gpg -k # This should list the new key
9898
gpg --armor --export ${my_email_address} | clip
9999
```
100100

@@ -112,7 +112,7 @@
112112
git config --global tag.gpgsign true
113113
```
114114
115-
1. Optional: Your new GPG key can be used within WSL, but not from Windows; to enable this:
115+
1. Now your key is created, make it avalable within Windows:
116116
117117
1. Export the key:
118118
@@ -124,17 +124,35 @@
124124
125125
> **Ensure both `GnuPG` and `Kleopatra` are installed!**
126126
127-
1. Open Kleopatra -> `Import` -> Select the `<GitHub handle>.pgp` file created in the first step.
127+
1. Open Kleopatra -> `Import` -> Select the `<GitHub handle>.pgp` file created in the first step
128128
1. In `cmd`, set your local git config to use GPG signing:
129129
130130
```bash
131+
gpg -k # This should list the new key
131132
git config --global user.email ${my_email_address} # same one used during key generation
132133
git config --global user.name ${my_username}
133134
git config --global user.signingkey = ${key_id}
134135
git config --global commit.gpgsign true
135136
git config --global tag.gpgsign true
136137
```
137138
139+
1. And finally, make it avalable within WSL:
140+
141+
1. Within Ubuntu:
142+
143+
```bash
144+
sudo ln -s /mnt/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg.exe /usr/local/bin/gpg
145+
sudo ln -s gpg /usr/local/bin/gpg2
146+
```
147+
148+
1. Close and reopen your Ubuntu terminal
149+
150+
1. Test the key is visible:
151+
152+
```bash
153+
gpg -k # This should list the new key
154+
```
155+
138156
> When you commit, you'll now be prompted to enter the GPG key passphrase into a Pinentry window.
139157

140158
## From Pipelines

0 commit comments

Comments
 (0)