Scroll to navigation

gbp-clone(1) git-buildpackage Manual gbp-clone(1)


gbp-clone - Clone a repository from remote


gbp clone
[--version] [--help] [--verbose] [--color=[auto|on|off]] [--color-scheme= COLOR_SCHEME] [--all] [--[no-]pristine-tar] [--debian-branch= branch_name] [--upstream-branch= branch_name] [--depth= depth] [--reference= repository] [--postclone= COMMAND] [--[no-]hooks] [--defuse-gitattributes= [auto|on|off]] [--repo-user= [GIT|DEBIAN]] [--repo-email= [GIT|DEBIAN]] [--[no-]aliases] [--[no-]add-upstream-vcs] repository [directory]


gbp clone clones a remote repository and sets up tracking branches for the debian, upstream and pristine-tar branches. This way you can easily update later using gbp pull.


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).
Track all branches, not only debian and upstream.
The branch in the Git repository the Debian package is being developed on, default is master.
The branch in the Git repository the upstream sources are put onto. Default is upstream.
Git history depth, for creating shallow git clones.
Local repository to use as alternate instead of re-copying data from remote repository.
Track pristine tar branch.
Enable running hooks.
Execute COMMAND after cloning the source from the remote.

Exported environment variables are: GBP_GIT_DIR (the repository the package is being built from).

Note that if you clone a repository that contains a hook configuration in debian/gbp.conf this hook will not be run automatically to prevent execution of untrusted code.

Disable Git attributes that may interfere with building packages. Works by updating .git/info/attributes to override attributes in the upstream sources which may cause files to be transformed on checkout. More specifically, a new macro attribute is defined, [attr]dgit-defuse-attrs, which is then applied to * together with export-subst and export-ignore. This is done to be compatible with dgit and git-deborig which disable Git attributes this way.

If set to auto, first check whether there are any .gitattributes files in the upstream source, and act only if there are some. If set to on, unconditionally there are some. If set to off, does nothing.

When set to DEBIAN use the DEBEMAIL environment variable to set the Git configuration otherwise use Git's defaults.
When set to DEBIAN use the DEBUSER environment variable to set the Git configuration otherwise use Git's defaults.
Whether to expand gbp specific aliases for remote repos like salsa:.
Whether to add the upstream git repository as additional remote. The repositor url is read from debian/upstream/meta.
The (possibly remote) repository to clone from. This is usually a Git URL but some shortcuts are supported (see below).
The directory to clone to.


Clone a repository and setup a tracking branch for pristine-tar as well:

gbp clone --pristine-tar git://

Clone from the Git-Vcs URL of a package:

gbp clone vcs-git:libvirt
gbp clone vcsgit:libvirt

Clone a repository from salsa (Debian's code hosting):

gbp clone salsa:agx/git-buildpackage

Clone from a github repository:

gbp clone github:agx/git-buildpackage


Several gbp.conf files are parsed to set defaults for the above command-line arguments. See the gbp.conf(5) manpage for details.


gbp-buildpackage(1), gbp-pull(1), gbp-setup-gitattributes(1), gbp.conf(5), gitattributes(5)


Guido Günther <>

24 November 2022