Skip to content

bb clone

Clone a repository to the local filesystem

bb clone <repository> [directory] [-- <gitflags>...] [flags]

Alias for bb repo clone.

# Clone into a directory named after the repository
bb clone PROJ/repo

# By the address the browser shows, into a directory of your choice
bb clone https://bitbucket.example.com/projects/PROJ/repos/repo work/repo

# Over HTTPS only, passing flags on to git
bb clone PROJ/repo --https -- --depth 1
--https
Use HTTPS only and skip the SSH clone attempt
--no-upstream
Do not add an upstream remote when cloning a fork
--ssh
Use SSH only and disable HTTPS fallback
-u, --upstream-remote-name string
Upstream remote name when cloning a fork (default "upstream")

Also takes the global flags.

Dry run: Shows that it would clone into a new directory, without doing it; nothing is checked first (predicted)

Output with --json, where ? marks a field that can be absent
data
  status           string   Outcome of the command.
  repository       object
    projectKey     string   Project key the repository belongs to.
    slug           string   Repository slug.
  cloneUrl         string   URL git was pointed at.
  directory        string   Directory the working tree landed in.
  noUpstream       boolean  Whether --no-upstream was passed, which stops bb looking for a parent at all.
  upstream         object
    configured     boolean  Whether the remote was added.
    name           string   Remote name that was used or would have been.
    url            string   Parent repository's clone URL.
  repositoryInput  object
    raw            string   The argument as it was typed.
    usedUrl        boolean  Whether that argument was a clone URL rather than a PROJECT/slug.