Skip to content

Commit

Permalink
Update docs, add images
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronBeneteau committed Nov 2, 2024
1 parent 1df6880 commit 9f25cc8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,35 @@
This tutorial will guide you through setting up SSH keys and commit signing for GitHub. SSH keys are a more secure way to connect to GitHub, rather than other protocols like HTTPS. Commit signing is used to verify that commits are coming from you and have not been tampered with.

!!! warning
You must have a verified email address on GitHub to add SSH keys and sign commits.
You must have a [verified email address on GitHub](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/verifying-your-email-address) to add SSH keys and sign commits.

## Create an SSH Key

=== "Windows"
In a bash terminal, enter the following command:

In an admin PowerShell terminal, enter the following command:
=== "Windows"

```text
ssh-keygen -t ed25519 -C "[email protected]"
```

??? Failure "Windows: `ssh-keygen` not recognized"

Older versions of Windows do not include SSH so it must be installed separately.

1. Open the __Settings__ app. Go to __System__ then __Optional Features__.
2. Click __Add a feature__ and search for "OpenSSH."
3. Install the feature. Restart your computer.
4. Add the OpenSSH directory to your PATH.

The default location is `C:\Windows\System32\OpenSSH`

Open a new terminal. You should be able to execute `ssh-keygen` and other `ssh` commands.

Save to the default location `c:/Users/YOU/.ssh/id_ed25519` and do not enter a passphrase. This will allow you to use the key without entering a password every time you push to GitHub.
When prompted, save to the default location `c:/Users/YOU/.ssh/id_ed25519` and do not enter a passphrase. This will allow you to use the key without entering a password every time you push to GitHub.

Continue with the following commands:

```text
type c:/Users/YOU/.ssh/id_ed25519 | clip
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
cat c:/Users/YOU/.ssh/id_ed25519 | clip.exe
eval "$(ssh-agent -s)"
ssh-add c:/Users/YOU/.ssh/id_ed25519
```

=== "Linux/Mac"

In a terminal window, enter the following command:

```text
ssh-keygen -t ed25519 -C "[email protected]"
```

Save to the default location `~/.ssh/id_ed25519` and do not enter a passphrase. This will allow you to use the key without entering a password every time you push to GitHub.
When prompted, save to the default location `~/.ssh/id_ed25519` and do not enter a passphrase. This will allow you to use the key without entering a password every time you push to GitHub.

Continue with the following commands:

Expand All @@ -73,8 +57,6 @@ ssh -T [email protected]
Type "yes" when it asks if you want to continue connecting.
You should see a message like "Hi username! You've successfully authenticated, but GitHub does not provide shell access."

Additional SSH GitHub documentation can be found [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection).

## Enable Commit Signing

To add a signing key to your GitHub account, go to <https://github.com/settings/ssh/new>.
Expand All @@ -89,15 +71,33 @@ Update your git configuration in your terminal to automatically sign commits wit
=== "Windows"
```text
git config --global user.signingkey c:/Users/YOU/.ssh/id_ed25519
git config --global gpg.format=ssh
git config --global gpg.format ssh
git config --global commit.gpgsign true
```

=== "Linux/Mac"
```text
git config --global user.signingkey ~/.ssh/id_ed25519
git config --global gpg.format=ssh
git config --global gpg.format ssh
git config --global commit.gpgsign true
```

Additional commit signing GitHub documentation can be found [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key).
## Enable Vigilant Mode

Go to <https://github.com/settings/ssh> and scroll down to the "Vigilant Mode" section. Enable "Enable Vigilant Mode".

![Vigilant Mode](./vigilant-mode.png)

This will now mark and display all of your commits with a signature verification status tag.

![Marked Commits](./marked-commits.png)

Verify your commits are signed by checking your commit history on GitHub for "Verified" tags.

## Resources

- [Generating a new SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)

- [Testing your SSH connection](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection)

- [Managing commit signature verification](https://docs.github.com/en/authentication/managing-commit-signature-verification)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/tutorials/ssh-signing/vigilant-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/includes/abbreviations.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
*[HV]: High Voltage. The vehicle circuit which powers our motors. Contrast with LV.
*[MCAL]: MicroController Abstraction Layer.
*[BMS]: Battery Management System. A vehicle device responsible for consistently and safely drawing power from the accumulator / battery.
*[SSH]: Secure Shell.
2 changes: 1 addition & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ nav:
- tutorials/site-dev.md
- tutorials/wsl-can/index.md
- tutorials/hw-debug.md
- tutorials/ssh-signing.md
- tutorials/ssh-signing/index.md
- Firmware:
- firmware/index.md
- firmware/dev-setup.md
Expand Down

0 comments on commit 9f25cc8

Please sign in to comment.