This command is used to clone REPO, a GitHub repository, to a DEST directory (defaults to the name of the project being cloned). If the repository is specified in <owner>/<project> form, the REPO will be used as upstream and a personal fork will be looked up. If none is found, a new fork will be created. In both cases, the fork will be cloned instead of the upstream repository. The REPO can be specified as a regular clone URL too (http, ssh, git), in that case the URL will be inspected and the hub.urltype will be set as appropriate.
If only <project> is specified as REPO, then the configuration hub.username is used as <owner>, and the parent repository is looked up at GitHub to determine the real upstream repository.
The upstream repository is cloned as --upstreamremote (or hub.upstreamremote, upstream by default), the remote for the fork is added as --forkremote (or hub.forkremote, fork by default) and the fork is set as the git remote.pushdefault (so pushing will hit the fork by default), unless --no-triangular is used (please see the option for more details).
After cloning and fetching, the git configuration variables hub.upstream, hub.upstreamremote and hub.forkremote are set in the new cloned repo (see CONFIGURATION).
-
-U NAME, --upstreamremote=NAME
-
Use NAME as the upstream remote repository name instead of the default 'upstream').
-
-F NAME, --forkremote=NAME
-
Use NAME as the fork remote repository name instead of the default 'fork').
-
-t, --triangular
-
Use Git's triangular workflow configuration (this is the default). This option clones from the parent/upstream repository, and adds the fork as a remote repository. Then sets the remote.pushdefault Git option and hub.forkremote git-hub option to the just cloned repository.
The effect of this having the upstream repository used by default when you pull but using your fork when you push, which is typically what you want when using GitHub's pull requests.
Git version 1.8.3 or newer is needed to use this option (and 1.8.4 or newer is recommended due to some issues in 1.8.3 related to this).
To change the default you can set the option hub.triangular. See CONFIGURATION for details.
-
--no-triangular
-
Don't use Git's triangular workflow configuration (this is only available for backwards compatibility but is not recommended). This option clones from the forked repository instead of cloning the upstream/parent repo, so both pulls and pushes will be done with the fork by default.
This option could be also used to clone a GitHub repository without forking it, but some functionality of the tool will be lost.
- GIT CLONE OPTIONS
-
Any standard git clone option can be passed. Not all of them might make sense when cloning a GitHub repo to be used with this tool though.
This command will run the hub.hookscript on some events, please have a look at HOOK SCRIPT for more details.