Add the following signedoff-by git hook using the following steps:
- Create a new file (from above) and add it to the project's git folder
.git/hooks/commit-msg - Make the hook executable
chmod +x .git/hooks/commit-msg| #!/bin/sh | |
| NAME=$(git config user.name) | |
| EMAIL=$(git config user.email) | |
| if [ -z "$NAME" ]; then | |
| echo "empty git config user.name" | |
| exit 1 | |
| fi | |
| if [ -z "$EMAIL" ]; then | |
| echo "empty git config user.email" | |
| exit 1 | |
| fi | |
| git interpret-trailers --if-exists doNothing --trailer \ | |
| "Signed-off-by: $NAME <$EMAIL>" \ | |
| --in-place "$1" |