git: Duplicate Signed-off-by lines

I’ve been playing around with git a lot as an alternative to subversion and am really loving it. However, I’m getting an error every time I try to commit:

Duplicate Signed-off-by lines.

I can see where this is being thrown inside .git/hooks/commit-msg, but it wasn’t immediately obvious what the problem was. I did a quick google search and found that others have had the same problem, but at least some members of the git community have been less than helpful. I did figure out the problem, and figured I’d share it here for others.

The commit-msg script is written using bash style shell expansions,

foo = $(bar)

while the shebang at the top of the file is set to /bin/sh. On many systems, this is not a bash shell. The solution is to simply modify the shebang to wherever bash is on your system (probably /usr/bin/bash or similar).

Comments and responses

Have you written a response to this? Let me know the URL:

Thanks so much for the solution, ’twas threatening to drive me batty!

(No issue in OS X 10.5.6’s bash, but for some reason TextDrive’s bash (on Solaris, presumably) and a slightly stale version of git ( were misbehaving)

This helped me git going again on Joyent's Shared Accelerators once I realized I needed to modify the first line of the .git/hooks/commit-msg file in my repository from this:


to this:


Thanks for helping put an end to that frustration.

Brilliant - this solved the problem for me on my Joyent Shared as well.

One question: is there any way of making this change permanent for all Git repos I pull onto my Joyent Shared?