LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

hub-clone

clones GitHub repositories using shorthand notation

TLDR

Clone with shorthand
$ hub clone [user/repo]
copy
Clone to directory
$ hub clone [user/repo] [directory]
copy
Clone with depth
$ hub clone --depth [1] [user/repo]
copy
Clone own repository
$ hub clone [repo-name]
copy

SYNOPSIS

hub clone [options] repository [directory]

DESCRIPTION

hub clone expands GitHub shorthand (`user/repo`, or just `repo` for your own repositories) into a full clone URL and then hands off to a normal git clone, so any git-clone option (--depth, -b, --recurse-submodules, etc.) works as-is. Without a `user/` prefix, hub assumes the repository belongs to the authenticated GitHub user.By default hub clones over HTTPS; set `git config --global hub.protocol ssh` to have it generate SSH URLs instead for clone, fork, and related commands.

PARAMETERS

[USER/]REPOSITORY

Repository to clone. USER defaults to your own GitHub username when omitted.
DIRECTORY
Target directory to clone into (default: the repository name).
-p
(Deprecated) Clone a private repository over SSH.
--depth N
Create a shallow clone with the given commit history depth. Passed straight through to git clone.
-b, --branch BRANCH
Checkout BRANCH instead of the remote's default branch. Passed straight through to git clone.
--help
Display help information.

INSTALL

sudo apt install hub
copy
sudo pacman -S hub
copy
sudo zypper install hub
copy
brew install hub
copy
nix profile install nixpkgs#hub
copy

CAVEATS

Hub is no longer actively maintained and has been superseded by the official GitHub CLI (gh, via gh repo clone). GitHub authentication is only needed for private repositories or to resolve `repo` (no user) shorthand against your own account; cloning a public `user/repo` works without it.

HISTORY

hub clone is part of hub, GitHub's original command-line tool that predates the official gh CLI.

SEE ALSO

hub(1), git-clone(1), gh(1)

RESOURCES

Copied to clipboard
Kai