Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With git 1.7.9, it's possible to sign a commit with the -S option. Is it possible to set it default through git config --global?

So instead of git commit -S -m 'Commit message', it would be just git commit -m 'Commit message'.

share|improve this question

closed as off topic by EEAA, Ward, Michael Hampton, Scott Pack, pauska Oct 5 '12 at 10:16

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

It is possible with new git with commit.gpgsign=true setting. – Vi. Jul 7 '14 at 18:35
up vote 4 down vote accepted

To sign automatically all future git commits, you can define a global alias. For example, to create a global alias called "c", you would do this:

$ git config --global alias.c 'commit -s'

(note that the commit switch to sign off is lowercase "-s" and NOT uppercase "-S", as you typed in your question).

After having done this, you can start doing your commits using your newly created "c" alias. Here's an example of creating and commiting a file called "test.txt" that will be signed off by the committer:

$ vim test.txt
[edit file]
$ git add test.txt
$ git c -m 'My commit message'

You can see that the commit has the "Signed-off-by:" line if you run the "git log" command with the --pretty=fuller option:

$ git log --pretty=fuller
share|improve this answer
-s adds a "signed off by" field to the commit. -S actually PGP signs the commit, which was added in git 1.7.9. Also, this does not sign all commits, but only those which are made by the user directly using the git c command. In a rebase, when new commits are created, this will not sign off on (or PGP sign) the commits, unless you do an interactive rebase and manually commit every change. – Patrick Niedzielski Dec 6 '13 at 20:19
For more information on signing commits, see here:… for instance – Patrick Niedzielski Dec 6 '13 at 20:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.