gbp-clone

&dhsection;

gbp-clone

Clone a &git; repository from a remote and set up the necessary branch tracking

          &gbp-clone;

          &man.common.options.synopsis;
          --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

## DESCRIPTION

Unlike a regular `git clone`, the &gbp-clone; will parse the debian/gbp.conf options and clone the remote repository with correct branches tracked.

Likewise, it is recommended to use &gbp-pull; and &gbp-push; to later update the repository as it will spare from having to run `git pull` and `git push` multiple times or with lengthy arguments to sync each tracked branch.

## OPTIONS

&man.common.options.description;

`--all`

- Track all branches, not only `debian` and `upstream`.

`--debian-branch`=`branch_name`

- The branch in the Git repository the Debian package is being developed on, default is `master`.

`--upstream-branch`=`branch_name`

- The branch in the &git; repository the upstream sources are put onto. Default is `upstream`.

`--depth`=`depth`

- Git history depth, for creating shallow git clones.

`--reference`=`repository`

- Local repository to use as alternate instead of re-copying data from remote repository.

`--pristine-tar`

- Track pristine tar branch.

`--[no-]hooks`

- Enable running hooks.

`--postclone=``COMMAND`

- 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.

`--defuse-gitattributes=``[auto|on|off]`

- 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.

`--repo-email=``[GIT|DEBIAN]`

- When set to `DEBIAN` use the `DEBEMAIL` environment variable to set the user.email &git; configuration otherwise use &git;'s defaults.

`--repo-user=``[GIT|DEBIAN]`

- When set to `DEBIAN` use the `DEBFULLNAME` environment variable to set the user.name &git; configuration otherwise use &git;'s defaults.

`--[no-]aliases`

- Whether to expand gbp specific aliases for remote repos like salsa:.

`--[no-]add-upstream-vcs`

- Whether to add the upstream git repository as additional remote. The repository url is read from the "Repository" field in `debian/upstream/metadata`.

`repository`

- The (possibly remote) repository to clone from. This is usually a &git; URL but some shortcuts are supported (see below).

`directory`

- The directory to clone to.

## EXAMPLES

Clone the Debian packaging repository and the upstream repository in one go:

    &gbp-clone; -add-upstream-vcs vcs-git:entr

The branches, tags and pristine-tar will be automatically setup correctly following the contents of debian/gbp.conf in the package, and there will be an additional git remote with the name upstreamvcs that points to the upstream Entr repository on GitHub.

A parameter on the command line would override anything in the debian/gbp.conf file. For example, clone a repository and setup a tracking branch for pristine-tar as well:

    &gbp-clone; --pristine-tar git://honk.sigxcpu.org/git/git-buildpackage.git

Clone from the Git-Vcs URL of a package:

    &gbp-clone; vcs-git: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

&man.gbp.config-files;

## SEE ALSO

man.gbp.buildpackage, man.gbp.pull, man.gbp.setup.gitattributes, man.gbp.conf,

gitattributes

5

## AUTHOR

&dhusername; &dhemail;