Skip to content

Commit f25f71d

Browse files
committed
docs: add commit signing setup instructions to CONTRIBUTING.md
Add GPG and SSH signing setup guides, update commit requirements to reference the new section, and fix markdown lint issues. Fixes #138 Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Andre Fredette <afredette@redhat.com>
1 parent 9f51f3e commit f25f71d

File tree

1 file changed

+120
-16
lines changed

1 file changed

+120
-16
lines changed

CONTRIBUTING.md

Lines changed: 120 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,50 @@
11
# Contributing to NeuralNav
22

3-
Thank you for your interest in contributing to NeuralNav! This document provides guidelines for contributing to the project.
3+
Thank you for your interest in contributing to NeuralNav! This document provides
4+
guidelines for contributing to the project.
45

56
## Table of Contents
67

78
- [Code of Conduct](#code-of-conduct)
89
- [Recommended Git Workflow](#recommended-git-workflow)
910
- [Guidelines](#guidelines)
11+
- [Commit Signing Setup](#commit-signing-setup)
1012
- [Commit Message Guidelines](#commit-message-guidelines)
1113
- [Testing Requirements](#testing-requirements)
1214
- [Documentation](#documentation)
1315
- [Communication](#communication)
1416

1517
## Code of Conduct
1618

17-
This project follows standard open source community guidelines. Be respectful, inclusive, and constructive in all interactions.
19+
This project follows standard open source community guidelines. Be respectful,
20+
inclusive, and constructive in all interactions.
1821

1922
## Recommended Git Workflow
2023

21-
This section describes the complete workflow from setup to submitting a pull request.
24+
This section describes the complete workflow from setup to submitting a pull
25+
request.
2226

2327
### Initial Setup (One-Time)
2428

2529
**1. Fork the repository** on GitHub to your own account.
2630

2731
**2. Clone your fork locally:**
32+
2833
```bash
2934
git clone https://github.com/YOUR_USERNAME/neuralnav.git
3035
cd neuralnav
3136
```
3237

3338
**3. Set up remotes:**
39+
3440
```bash
3541
# Your fork is already set as 'origin' by the clone
3642
# Add the main repository as 'upstream'
3743
git remote add upstream https://github.com/redhat-et/neuralnav.git
3844
```
3945

4046
Verify your remotes:
47+
4148
```bash
4249
git remote -v
4350
# origin https://github.com/YOUR_USERNAME/neuralnav.git (fetch)
@@ -46,84 +53,100 @@ git remote -v
4653
# upstream https://github.com/redhat-et/neuralnav.git (push)
4754
```
4855

49-
**4. Set up your development environment** by following the [Quick Start guide](README.md#quick-start).
56+
**4. Set up your development environment** by following the [Quick Start
57+
guide](README.md#quick-start).
5058

5159
### Keep Your Main Branch Synchronized
5260

5361
Before starting new work, sync your local main with upstream:
62+
5463
```bash
5564
git checkout main
5665
git fetch upstream
5766
git rebase upstream/main
5867
git push origin main # Keeps your fork's main updated on GitHub
5968
```
6069

61-
NOTE: Don't make any changes directly on your fork's main branch -- keep it in sync with upstream/main.
70+
NOTE: Don't make any changes directly on your fork's main branch -- keep it in
71+
sync with upstream/main.
6272

6373
### Development Workflow
6474

6575
**1. Create a branch from main:**
76+
6677
```bash
6778
git checkout main
6879
git checkout -b your-feature-name # branch names like feature/your-feature-name are common but not required.
6980
git push -u origin your-feature-name
7081
```
7182

72-
The `-u` flag sets up tracking so future `git push` and `git pull` commands work without specifying the remote.
83+
The `-u` flag sets up tracking so future `git push` and `git pull` commands work
84+
without specifying the remote.
7385

7486
**2. Do your work and create logical commits:**
87+
7588
```bash
7689
# Make changes...
7790
git add <files>
7891
git commit -s -m "feat: Add your feature description"
7992
```
8093

81-
Use the `-s` flag to add the required DCO sign-off. See [Commit Message Guidelines](#commit-message-guidelines) for formatting details.
94+
Use the `-s` flag to add the required DCO sign-off. See [Commit Message
95+
Guidelines](#commit-message-guidelines) for formatting details.
8296

8397
**3. Push to your fork:**
98+
8499
```bash
85100
git push
86101
```
87102

88103
### Submitting a Pull Request
89104

90105
**1. Before submitting, rebase on upstream/main:**
106+
91107
```bash
92108
git fetch upstream
93109
git rebase upstream/main
94110
```
95111

96-
Resolve any conflicts if they occur, then force push (needed because rebasing rewrites history):
112+
Resolve any conflicts if they occur, then force push (needed because rebasing
113+
rewrites history):
114+
97115
```bash
98116
git push -f
99117
```
100118

101119
**2. Run tests locally:**
120+
102121
```bash
103122
make test
104123
make lint
105124
```
106125

107126
**3. Create the PR from GitHub:**
108127

109-
When you're ready to submit your changes in a PR, visit either your fork or the main repo on GitHub.
110-
If you've pushed recently, you'll see a prompt: "Compare & pull request" — click it.
128+
When you're ready to submit your changes in a PR, visit either your fork or the
129+
main repo on GitHub. If you've pushed recently, you'll see a prompt: "Compare &
130+
pull request" — click it.
111131

112-
Alternatively, go to the upstream repository and click "New pull request", then select your fork and branch.
132+
Alternatively, go to the upstream repository and click "New pull request", then
133+
select your fork and branch.
113134

114135
## Guidelines
115136

116137
### Discuss Before You Code
117138

118139
**For significant changes**, discuss your approach upfront:
119140
- Open an issue describing the problem and proposed solution
120-
- For substantial features or architectural changes, create a design document in `docs/`
141+
- For substantial features or architectural changes, create a design document in
142+
`docs/`
121143
- Wait for feedback from maintainers before investing significant effort
122144
- Small bug fixes and typos don't require prior discussion
123145

124146
### Keep PRs Small and Targeted
125147

126-
- **Aim for PRs under 500 lines** whenever possible (not counting auto-generated code)
148+
- **Aim for PRs under 500 lines** whenever possible (not counting auto-generated
149+
code)
127150
- Each PR should address a single concern or feature
128151
- Break large features into incremental PRs that preserve functionality
129152
- Incremental PRs should:
@@ -133,6 +156,7 @@ Alternatively, go to the upstream repository and click "New pull request", then
133156
- Update documentation as needed
134157

135158
**Example of breaking up a large feature**:
159+
136160
```
137161
PR 1: Add database schema for new feature (no breaking changes)
138162
PR 2: Implement backend API endpoints with tests
@@ -146,7 +170,8 @@ If a breaking change is unavoidable:
146170
- Discuss in an issue first with the "breaking-change" label
147171
- Document the migration path clearly
148172
- Consider deprecation warnings before removal
149-
- For very large refactors, consider working from a branch in the main repository
173+
- For very large refactors, consider working from a branch in the main
174+
repository
150175
- Provide upgrade instructions in the PR description
151176

152177
### PR Requirements
@@ -197,6 +222,76 @@ Fixes #[issue number]
197222
- Rebase and force-push if requested (don't create merge commits)
198223
- Be open to suggestions and iterate on your implementation
199224

225+
## Commit Signing Setup
226+
227+
All commits must be cryptographically signed. You can use either GPG or SSH
228+
signing — choose whichever you prefer.
229+
230+
### Option A: SSH Signing (Recommended)
231+
232+
SSH signing reuses keys you likely already have.
233+
234+
**1. Configure git to sign commits with SSH:**
235+
236+
```bash
237+
git config --global commit.gpgsign true
238+
git config --global gpg.format ssh
239+
git config --global user.signingkey ~/.ssh/id_ed25519.pub
240+
```
241+
242+
Replace `~/.ssh/id_ed25519.pub` with the path to your actual SSH public key
243+
(e.g., `~/.ssh/id_rsa.pub`).
244+
245+
**2. Add your key to GitHub** as a **Signing Key** (not just Authentication):
246+
247+
- Go to **GitHub > Settings > SSH and GPG keys > New SSH key**
248+
- Set **Key type** to **Signing Key**
249+
- Paste your public key
250+
251+
### Option B: GPG Signing
252+
253+
**1. Generate a GPG key** (if you don't have one):
254+
255+
```bash
256+
gpg --full-generate-key
257+
```
258+
259+
Select RSA 4096-bit, and use the same email as your GitHub account.
260+
261+
**2. Get your key ID:**
262+
263+
```bash
264+
gpg --list-secret-keys --keyid-format=long
265+
```
266+
267+
Look for the key ID after `sec rsa4096/` (e.g., `ABCDEF1234567890`).
268+
269+
**3. Configure git:**
270+
271+
```bash
272+
git config --global commit.gpgsign true
273+
git config --global user.signingkey ABCDEF1234567890
274+
```
275+
276+
**4. Add your GPG key to GitHub:**
277+
278+
```bash
279+
gpg --armor --export ABCDEF1234567890
280+
```
281+
282+
Copy the output and add it at **GitHub > Settings > SSH and GPG keys > New GPG
283+
key**.
284+
285+
### Verifying Your Setup
286+
287+
After setup, make a test commit and verify it shows as signed:
288+
289+
```bash
290+
git log --show-signature -1
291+
```
292+
293+
On GitHub, signed commits display a **Verified** badge.
294+
200295
## Commit Message Guidelines
201296

202297
### Format
@@ -227,10 +322,16 @@ Follow the [Conventional Commits](https://www.conventionalcommits.org/) style:
227322
- Bad: "Added GPU costs" or "This adds GPU cost calculation"
228323
- **Body**: Wrap at 72 characters, explain what and why (not how)
229324
- **Sign-off**: Include DCO sign-off with `-s` flag:
325+
230326
```bash
231327
git commit -s -m "feat: Add support for custom SLO templates"
232328
```
233-
- **AI Assistance**: Nontrivial and substantial AI-generated or AI-assisted content should be “marked”. Using the `Assisted-by:` tag is recommended as shown in the following example:
329+
330+
- **Signing**: All commits must be cryptographically signed (GPG or SSH). See
331+
[Commit Signing Setup](#commit-signing-setup) for configuration.
332+
- **AI Assistance**: Nontrivial and substantial AI-generated or AI-assisted
333+
content should be “marked”. Using the `Assisted-by:` tag is recommended as
334+
shown in the following example:
234335

235336
```
236337
Assisted-by: Claude <noreply@anthropic.com>
@@ -314,10 +415,12 @@ make format
314415
### Stay in Touch
315416

316417
- **Rebase often**: Keep your branch up-to-date with upstream/main
418+
317419
```bash
318420
git fetch upstream
319421
git rebase upstream/main
320422
```
423+
321424
- **Communicate frequently**:
322425
- Comment on issues and PRs
323426
- Ask questions if requirements are unclear
@@ -332,7 +435,8 @@ make format
332435

333436
## License
334437

335-
By contributing to NeuralNav, you agree that your contributions will be licensed under the same license as the project (see [LICENSE](LICENSE)).
438+
By contributing to NeuralNav, you agree that your contributions will be licensed
439+
under the same license as the project (see [LICENSE](LICENSE)).
336440

337441
## Questions?
338442

0 commit comments

Comments
 (0)