DOKK / manpages / debian 12 / git-buildpackage / gbp-setup-gitattributes.1.en
gbp-setup-gitattributes(1) git-buildpackage Manual gbp-setup-gitattributes(1)

gbp-setup-gitattributes - Set up Git attributes for packaging

gbp setup-gitattributes
[--version] [--help] [--verbose] [--color=[auto|on|off]] [--color-scheme= COLOR_SCHEME] [--[no-]dgit-defuse-attrs] [--all]

gbp setup-gitattributes sets up .git/info/attributes in the current Git repository to sane defaults most suitable for packaging work. At the moment, this amounts to making sure no transformations happen during checkout, commit or export. More attributes may be added in future, by default all known settings are applied.

Upstream sources may ship .gitattributes files enabling certain transformations to the committed source, usually to make working with files in different encodings more convenient for the upstream authors. For Debian packaging, it is necessary to override these attributes, since they cause often unwanted conversion of files (e.g. line endings, encodings and some others). Working with such source tree is confusing, since the working tree differs from the Git history (and sometimes from the source tarball), and can lead to errors.

By default, gbp clone tries to detect the usage of .gitattributes in the upstream source and disables the Git attributes only when necessary.

Print version of the program, i.e. version of the git-buildpackage suite
Verbose execution
Print help and exit
Whether to use colored output.
Colors to use in output (when color is enabled). The format for COLOR_SCHEME is '<debug>:<info>:<warning>:<error>'. Numerical values and color names are accepted, empty fields imply the default color. For example, --git-color-scheme='cyan:34::' would show debug messages in cyan, info messages in blue and other messages in default (i.e. warning and error messages in red).
Disables all transforming attributes for all files. This is done by defining a macro attribute [attr]dgit-defuse-attrs and applying it to * together with export-subst and export-ignore.

This method is compatible with dgit and git-deborig which use this macro attribute. Older versions of dgit use an incomplete preset missing some attributes; if such is found, it is replaced by an updated definition.

Apply all known Git attribute settings. This is the default.

gbp-clone(1), gbp-push(1), gbp.conf(5), gitattributes(5), dgit(7)

Andrej Shadura <>

24 November 2022