grgit-clone
Synopsis
Grgit.clone(dir: <path>, uri: <path or uri>, remote: <name>, all: <boolean>,
bare: <boolean>, branches: <full refs>, checkout: <boolean>,
refToCheckout: <name>, depth: <integer>, credentials: <credentials>)
Grgit.clone {
dir = <path>
uri = <path or uri>
remote = <name>
all = <boolean>
bare = <boolean>
branches = <full refs>
checkout = <boolean>
refToCheckout = <name>
depth = <integer>
credentials = <credentials>
}
Description
Clones a repository into a newly created directory, creates remote-tracking branches for each branch in the cloned repository, and creates and checks out an initial branch that is forked from the cloned repository’s currently active branch.
After the clone, a plain grgit-fetch without arguments will update all the remote-tracking branches, and a grgit-pull without arguments will in addition merge the remote master branch into the current master branch.
This default configuration is achieved by creating references to the remote branch heads under refs/remotes/origin
and by initializing remote.origin.url
and remote.origin.fetch
configuration variables.
Returns a Grgit instance.
Options
- dir
-
(
Object
, defaultnull
) The directory the repository should be cloned into. Can be aFile
,Path
, orString
. - uri
-
(
String
, defaultnull
) The URI to the repository to be cloned. - remote
-
(
String
, defaultorigin
) Instead of using the remote nameorigin
to keep track of the upstream repository, use<name>
. - all
-
(
boolean
, defaultfalse
) Clone all branches. - bare
-
(
boolean
, defaultfalse
) Create a bare repository. - branches
-
(
List<String>
,[]
) Select full refs to use withall = false
. - checkout
-
(
boolean
, defaulttrue
) Set tofalse
to skip checking out aHEAD
. - refToCheckout
-
(
String
, defaultnull
) Instead of pointing the newly createdHEAD
to the branch pointed to by the cloned repository’sHEAD
, point to<name>
branch instead. In a non-bare repository, this is the branch that will be checked out. This can also take tags and detaches theHEAD
at that commit in the resulting repository. - depth
-
(
Integer
, defaultnull
) If set, does a shallow clone to the specified depth - credentials
-
(
Credentials
, defaultnull
) An instance of Credentials containing username/password to be used in operations that require authentication. See grgit-authentication for preferred ways to configure this.