---
name: "gbp-clone"
section: "1"
platform: "linux"
package: "git-buildpackage"
version: "0.9.38"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gbp-clone"
---

# gbp-clone(1)

Clone a Git repository from a remote and set up the necessary branch tracking

## NAME

gbp-clone - Clone a Git repository from a remote and set up the necessary branch tracking

## SYNOPSIS

FC**gbp clone**F\[0\]  \[FC**--version**F\[0\]\] \[FC**--help**F\[0\]\] \[FC**--verbose**F\[0\]\] \[FC**--color=**F\[0\]\[auto\|on\|off\]\] \[FC**--color-scheme=**F\[0\] *COLOR\_SCHEME*\] \[FC**--all**F\[0\]\] \[FC**--\[no-\]pristine-tar**F\[0\]\] \[FC**--debian-branch=**F\[0\] *branch\_name*\] \[FC**--upstream-branch=**F\[0\] *branch\_name*\] \[FC**--depth=**F\[0\] *depth*\] \[FC**--reference=**F\[0\] *repository*\] \[FC**--postclone=**F\[0\] *COMMAND*\] \[FC**--\[no-\]hooks**F\[0\]\] \[FC**--defuse-gitattributes=**F\[0\] *\[auto\|on\|off\]*\] \[FC**--repo-user=**F\[0\] FC**\[GIT\|DEBIAN\]**F\[0\]\] \[FC**--repo-email=**F\[0\] FC**\[GIT\|DEBIAN\]**F\[0\]\] \[FC**--\[no-\]aliases**F\[0\]\] \[FC**--\[no-\]add-upstream-vcs**F\[0\]\] *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

- FC**--version**F\[0\]

  Print version of the program, i.e. version of the git-buildpackage suite

- FC**-v**F\[0\], FC**--verbose**F\[0\]

  Verbose execution

- FC**-h**F\[0\], FC**--help**F\[0\]

  Print help and exit

- FC**--color=**F\[0\]\[auto\|on\|off\]

  Whether to use colored output.

- FC**--color-scheme=**F\[0\]*COLOR\_SCHEME*

  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, FC**--git-color-scheme=**F\[0\]FC'cyan:34::'F\[0\] would show debug messages in cyan, info messages in blue and other messages in default (i.e. warning and error messages in red).

- FC**--all**F\[0\]

  Track all branches, not only *debian* and *upstream*.

- FC**--debian-branch**F\[0\]=*branch\_name*

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

- FC**--upstream-branch**F\[0\]=*branch\_name*

  The branch in the Git repository the upstream sources are put onto. Default is *upstream*.

- FC**--depth**F\[0\]=*depth*

  Git history depth, for creating shallow git clones.

- FC**--reference**F\[0\]=*repository*

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

- FC**--pristine-tar**F\[0\]

  Track pristine tar branch.

- FC**--\[no-\]hooks**F\[0\]

  Enable running hooks.

- FC**--postclone=**F\[0\]*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 FC*debian/gbp.conf*F\[0\] this hook will not be run automatically to prevent execution of untrusted code.

- FC**--defuse-gitattributes=**F\[0\]FC**\[auto\|on\|off\]**F\[0\]

  Disable Git attributes that may interfere with building packages. Works by updating FC*.git/info/attributes*F\[0\] to override attributes in the upstream sources which may cause files to be transformed on checkout. More specifically, a new macro attribute is defined, FC\[attr\]dgit-defuse-attrsF\[0\], which is then applied to FC*\**F\[0\] together with FCexport-substF\[0\] and FCexport-ignoreF\[0\]. 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 FC*.gitattributes*F\[0\] 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.

- FC**--repo-email=**F\[0\]FC**\[GIT\|DEBIAN\]**F\[0\]

  When set to FC**DEBIAN**F\[0\] use the **DEBEMAIL** environment variable to set the user.email Git configuration otherwise use Git's defaults.

- FC**--repo-user=**F\[0\]FC**\[GIT\|DEBIAN\]**F\[0\]

  When set to FC**DEBIAN**F\[0\] use the **DEBFULLNAME** environment variable to set the user.name Git configuration otherwise use Git's defaults.

- FC**--\[no-\]aliases**F\[0\]

  Whether to expand gbp specific aliases for remote repos like FCsalsa:F\[0\].

- FC**--\[no-\]add-upstream-vcs**F\[0\]

  Whether to add the upstream git repository as additional remote. The repository url is read from the "Repository" field in FC*debian/upstream/metadata*F\[0\].

- *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:

```
FCgbp clone -add-upstream-vcs vcs-git:entrF[0]
```

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:

```
FCgbp clone --pristine-tar git://honk.sigxcpu.org/git/git-buildpackage.gitF[0]
```

Clone from the *Git-Vcs* URL of a package:

```
FCgbp clone vcs-git:libvirtF[0]
```

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

```
FCgbp clone salsa:agx/git-buildpackageF[0]
```

Clone from a GitHub repository:

```
FCgbp clone github:agx/git-buildpackageF[0]
```

## CONFIGURATION FILES

Several FC*gbp.conf*F\[0\] files are parsed  to set defaults for the above command-line arguments. See the [**gbp.conf**(5)](/gbp.conf/5.md) manpage for details.

## SEE ALSO

[**gbp-buildpackage**(1)](/gbp-buildpackage/1.md), [**gbp-pull**(1)](/gbp-pull/1.md), [**gbp-setup-gitattributes**(1)](/gbp-setup-gitattributes/1.md), [**gbp.conf**(5)](/gbp.conf/5.md), [**gitattributes**(5)](/gitattributes/5.md)

## AUTHOR

Guido Günther \<FCagx@sigxcpu.orgF\[0\]\>
