Skip to content

Commit 1832cbc

Browse files
committed
docs: [#446] add mandatory GPG commit signing requirement
1 parent d680a4d commit 1832cbc

2 files changed

Lines changed: 36 additions & 9 deletions

File tree

.github/skills/dev/git-workflow/commit-changes/skill.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ This skill guides you through the complete commit process for the Torrust Tracke
1919
# 2. Stage changes
2020
git add <files>
2121

22-
# 3. Commit with conventional format
23-
git commit -m "{type}: [#{issue}] {description}"
22+
# 3. Commit with conventional format and GPG signature (MANDATORY)
23+
git commit -S -m "{type}: [#{issue}] {description}"
2424
```
2525

2626
## Conventional Commit Format
@@ -60,6 +60,16 @@ When working on a branch with an issue number, include it in your commit message
6060
| `ci` | CI/CD related changes | `ci: [#23] add workflow for testing provisioning` |
6161
| `perf` | Performance improvements | `perf: [#52] optimize container startup time` |
6262

63+
## GPG Commit Signing (MANDATORY)
64+
65+
**All commits must be GPG signed.** Use the `-S` flag:
66+
67+
```bash
68+
git commit -S -m "your commit message"
69+
```
70+
71+
Ensure GPG is configured (see Troubleshooting section if signing fails).
72+
6373
## Pre-commit Verification (MANDATORY)
6474

6575
**Before committing any changes**, you **MUST** run:
@@ -207,15 +217,30 @@ vim src/main.rs
207217
# 4. Stage changes
208218
git add src/main.rs
209219

210-
# 5. Commit with conventional format
211-
git commit -m "feat: [#42] add new CLI command"
220+
# 5. Commit with conventional format and GPG signature (MANDATORY)
221+
git commit -S -m "feat: [#42] add new CLI command"
212222

213223
# 6. Push to remote
214224
git push origin 42-add-new-cli-command
215225
```
216226

217227
## Troubleshooting
218228

229+
### GPG Signing Fails
230+
231+
**Problem**: `git commit -S` fails with "gpg failed to sign the data"
232+
233+
**Solution**:
234+
235+
1. Verify GPG is installed: `gpg --version`
236+
2. List your GPG keys: `gpg --list-keys`
237+
3. If no keys exist, create one: `gpg --gen-key`
238+
4. Configure Git to use your GPG key: `git config --global user.signingkey <YOUR_KEY_ID>`
239+
5. Test signing: `echo "test" | gpg --clearsign`
240+
6. Retry commit: `git commit -S -m "your message"`
241+
242+
If still failing, check that your GPG agent is running and has proper pinentry configured.
243+
219244
### Pre-commit Script Fails
220245

221246
**Problem**: One or more checks fail in `./scripts/pre-commit.sh`
@@ -261,8 +286,9 @@ Note: This is only supported in local environments with proper LXD networking an
261286

262287
## Key Reminders
263288

264-
1. **Always run `./scripts/pre-commit.sh` before committing** - This is non-negotiable
265-
2. **Use issue numbers consistently** - Follow the `[#{issue}]` format
266-
3. **Be careful with hashtags** - Only use `#NUMBER` when referencing issues
267-
4. **Keep commits atomic** - One logical change per commit
268-
5. **Write descriptive messages** - Future you will thank present you
289+
1. **Always sign commits with `-S`** - GPG signing is mandatory for audit trail
290+
2. **Always run `./scripts/pre-commit.sh` before committing** - This is non-negotiable
291+
3. **Use issue numbers consistently** - Follow the `[#{issue}]` format
292+
4. **Be careful with hashtags** - Only use `#NUMBER` when referencing issues
293+
5. **Keep commits atomic** - One logical change per commit
294+
6. **Write descriptive messages** - Future you will thank present you

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ For detailed information about working with deployed instances, see [`docs/user-
134134
- Individual linters: `cargo run --bin linter {markdown|yaml|toml|cspell|clippy|rustfmt|shellcheck}`
135135
- Alternative: `./scripts/lint.sh` (wrapper that calls the Rust binary)
136136
- **Dependencies**: `cargo machete` (mandatory before commits - no unused dependencies)
137+
- **Commit Signing**: All commits **must** be signed with GPG (`git commit -S`) for audit trail
137138
- **Build**: `cargo build`
138139
- **Test**: `cargo test`
139140
- **Unit Tests**: When writing unit tests, follow conventions described in [`docs/contributing/testing/`](docs/contributing/testing/)

0 commit comments

Comments
 (0)