Configuring Git (Host) and VS Code for Signed-off-by Commits

Configuring Git (Host) and VS Code for Signed-off-by Commits

1. Configure Git Identity

git config --global user.name "Rafael Sene" git config --global user.email "rafael@riscv.org"

2. Remove Duplicate Sign-off Sources

Duplicates often happen if a commit template or hook also adds Signed-off-by.

Remove commit template if set:

git config --global --unset commit.template git config --unset commit.template

Check repo hooks:

ls -l .git/hooks/commit-msg

If it exists and appends a sign-off, delete it:

rm .git/hooks/commit-msg

3. Optional: Repo-local Identity

For projects where you need a different email/name:

git config --local user.name "Rafael Sene" git config --local user.email "rafael@riscv.org"

Configure VS Code

A. Global Settings

Open Command Palette → Preferences: Open Settings (JSON)

  • MacOS: press ⇧⌘P (Shift + Command + P) to launch the Command Palette and type Preferences: Open Settings (JSON).

  • Linux: press Ctrl+Shift+P to launch the Command Palette and type Preferences: Open Settings (JSON).

  • Windows: press Ctrl+Shift+P to open the Command Palette and type Preferences: Open Settings (JSON).

Add the Git Setting:

"git.alwaysSignOff": true

This ensures VS Code always runs git commit -s.

If other settings already exist, make sure to add a comma before/after as needed.

Create a .vscode/settings.json in the repo:

{ "git.alwaysSignOff": true }

Verify

  1. Make a commit using the Source Control panel in VS Code.

  2. Run in terminal:

git log -1 --pretty=full
  1. You should see something like:

Signed-off-by: Your Name <your.email@example.com>

RISC-V International