gitformat-signature - Linux


gitformat-signature generates a commit signature for tracked Git files. It’s useful for signing commits for compliance purposes and providing authorship attribution.


gitformat-signature [options] <path>


  • -s, –sign
    Sign the files with the default GPG key.
  • -k, –sign-key
    Use a specific GPG key ID to sign.
  • -t, –force-timestamp
    Force the usage of a timestamp in the signature.
  • -S, –force-signature
    Force a signature even if it’s not necessary.
  • -X, –force-x509
    Force the use of an X.509 certificate instead of GPG.
  • -n, –dry-run
    Do not make any changes, just show what would have been done.
  • -v, –verbose
    Display more verbose output.
  • -h, –help
    Display help.


Sign a single file:

gitformat-signature -s

Sign all changed files:

gitformat-signature .

Use a specific key:

gitformat-signature --sign-key 0x12345678 file.txt

Common Issues

  • No default GPG key found: Ensure you have a GPG key configured.
  • Unable to sign file: The file may be untracked or not managed by Git.
  • Failed to parse certificate: The certificate may be invalid or corrupt.


gitformat-signature can be integrated into Git hooks:

pre-commit = /usr/bin/gitformat-signature --sign

Related Commands

  • gpg
  • git-commit