|
43 | 43 | > If you go for the private email option, consider enabling `Block command line pushes that expose my email`. |
44 | 44 |
|
45 | 45 | 1. Avoid adding a comment (this *may* prevent git from auto-selecting a key - see Troubleshooting section below) |
| 46 | + 1. Review your inputs and press enter `O` to confirm |
46 | 47 | 1. Define a passphrase for the key |
47 | 48 |
|
48 | 49 | 1. Test the key is visible and export the PGP PUBLIC KEY (to your clipboard): |
49 | 50 |
|
50 | 51 | ```bash |
51 | 52 | gpg -k # This should list the new key |
52 | | - gpg --armor --export ${my_email_address} | pbcopy |
| 53 | + gpg --armor --export <my_email_address> | pbcopy |
53 | 54 | ``` |
54 | 55 |
|
| 56 | + > [!NOTE] |
| 57 | + > Your PGP PUBLIC KEY is now in your clipboard! |
| 58 | + |
55 | 59 | 1. [Add the public key to your GitHub account](https://github.com/settings/gpg/new) (`Settings` -> `SSH and GPG keys` -> `New GPG key`) |
56 | 60 |
|
57 | 61 | > Note the `Key ID` as you'll need this in the next step. |
58 | 62 |
|
59 | 63 | 1. Set your local git config to use GPG signing: |
60 | 64 |
|
61 | 65 | ```bash |
62 | | - git config --global user.email ${my_email_address} # same one used during key generation |
63 | | - git config --global user.name ${github_handle} |
64 | | - git config --global user.signingkey ${key_id} |
| 66 | + git config --global user.email <my_email_address> # same one used during key generation |
| 67 | + git config --global user.name <github_handle> |
| 68 | + git config --global user.signingkey <key_id> |
65 | 69 | git config --global commit.gpgsign true |
66 | 70 | git config --global tag.gpgsign true |
67 | 71 | ``` |
|
72 | 76 |
|
73 | 77 | ### Windows |
74 | 78 |
|
75 | | -1. Install [Git for Windows](https://git-scm.com/download/win) (which includes Bash and GnuPG) |
| 79 | +1. Install (as administrator) [Git for Windows](https://git-scm.com/download/win) (which includes Bash and GnuPG) |
76 | 80 | 1. Open `Git Bash` |
77 | 81 | 1. Create a new GPG key: |
78 | 82 |
|
|
89 | 93 | > If you go for the private email option, consider enabling `Block command line pushes that expose my email`. |
90 | 94 |
|
91 | 95 | 1. Avoid adding a comment (this *may* prevent git from auto-selecting a key - see Troubleshooting section below) |
92 | | - 1. Define a passphrase for the key |
| 96 | + 1. Review your inputs and press enter `O` to confirm |
| 97 | + 1. A new window called pinentry will appear prompting you to enter a passphrase. |
93 | 98 |
|
94 | 99 | 1. Test the key is visible and export the PGP PUBLIC KEY (to your clipboard): |
95 | 100 |
|
96 | 101 | ```bash |
97 | 102 | gpg -k # This should list the new key |
98 | | - gpg --armor --export ${my_email_address} | clip |
| 103 | + gpg --armor --export <my_email_address> | clip |
99 | 104 | ``` |
100 | 105 |
|
| 106 | + > [!NOTE] |
| 107 | + > Your PGP PUBLIC KEY is now in your clipboard! |
| 108 | + |
101 | 109 | 1. [Add the public key to your GitHub account](https://github.com/settings/gpg/new) (`Settings` -> `SSH and GPG keys` -> `New GPG key`) |
102 | 110 |
|
103 | 111 | > Note the `Key ID` as you'll need this in the next step. |
104 | 112 |
|
105 | 113 | 1. Set your local git config to use GPG signing: |
106 | 114 |
|
107 | 115 | ```bash |
108 | | - git config --global user.email ${my_email_address} # same one used during key generation |
109 | | - git config --global user.name ${github_handle} |
110 | | - git config --global user.signingkey ${key_id} |
| 116 | + git config --global user.email <my_email_address> # same one used during key generation |
| 117 | + git config --global user.name <github_handle> |
| 118 | + git config --global user.signingkey <key_id> |
111 | 119 | git config --global commit.gpgsign true |
112 | 120 | git config --global tag.gpgsign true |
113 | 121 | ``` |
|
117 | 125 | 1. Export the key: |
118 | 126 |
|
119 | 127 | ```bash |
120 | | - gpg --output <GitHub handle>.pgp --export-secret-key ${my_email_address}$ |
| 128 | + gpg --output <GitHub handle>.pgp --export-secret-key <my_email_address> |
121 | 129 | ``` |
122 | 130 |
|
123 | | - 1. Install [Gpg4win](https://www.gpg4win.org/) (which includes GnuPG and Kleopatra) |
| 131 | + 1. Install (as administrator) [Gpg4win](https://www.gpg4win.org/) (which includes GnuPG and Kleopatra) |
124 | 132 |
|
125 | 133 | > **Ensure both `GnuPG` and `Kleopatra` are installed!** |
126 | 134 |
|
|
129 | 137 |
|
130 | 138 | ```bash |
131 | 139 | gpg -k # This should list the new key |
132 | | - git config --global user.email ${my_email_address} # same one used during key generation |
133 | | - git config --global user.name ${github_handle} |
134 | | - git config --global user.signingkey ${key_id} |
| 140 | + git config --global user.email <my_email_address> # same one used during key generation |
| 141 | + git config --global user.name <github_handle> |
| 142 | + git config --global user.signingkey <key_id> |
135 | 143 | git config --global commit.gpgsign true |
136 | 144 | git config --global tag.gpgsign true |
137 | 145 | ``` |
|
151 | 159 |
|
152 | 160 | ```bash |
153 | 161 | gpg -k # This should list the new key |
154 | | - git config --global user.email ${my_email_address} # same one used during key generation |
155 | | - git config --global user.name ${github_handle} |
156 | | - git config --global user.signingkey ${key_id} |
| 162 | + git config --global user.email <my_email_address> # same one used during key generation |
| 163 | + git config --global user.name <github_handle> |
| 164 | + git config --global user.signingkey <key_id> |
157 | 165 | git config --global commit.gpgsign true |
158 | 166 | git config --global tag.gpgsign true |
159 | 167 | ``` |
|
0 commit comments