Class: Git::Commands::Clone Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
arguments block audited against https://git-scm.com/docs/git-clone/2.53.0
Implements the git clone command
Clones a repository into a newly created directory.
Examples:
Typical usage
Typical usage
clone = Git::Commands::Clone.new(execution_context)
clone.call('https://github.com/user/repo.git')
clone.call('https://github.com/user/repo.git', 'local-dir')
clone.call('https://github.com/user/repo.git', 'local-dir', bare: true)
clone.call('https://github.com/user/repo.git', 'local-dir', depth: 1)
See Also:
Instance Method Summary collapse
-
#call(repository, directory = nil, **options) ⇒ Git::CommandLineResult
Execute the
git clonecommand.
Methods inherited from Base
allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation
Constructor Details
This class inherits a constructor from Git::Commands::Base
Instance Method Details
#call(repository, directory = nil, **options) ⇒ Git::CommandLineResult
Execute the git clone command
Parameters:
-
repository
(String)
—
the URL or path of the repository to clone
-
directory
(String, nil)
(defaults to: nil)
—
the directory to clone into; git derives the name from the repository URL when omitted
-
options
(Hash)
—
command options
Options Hash (**options):
-
:template
(String)
— default:
nil
—
directory from which templates will be used
-
:local
(Boolean, nil)
— default:
nil
—
bypass the normal Git-aware transport for local clones (
--local)Alias:
:l -
:no_local
(Boolean, nil)
— default:
nil
—
disable the local optimization and use the normal transport (
--no-local) -
:shared
(Boolean, nil)
— default:
nil
—
set up a shared clone using alternates instead of hardlinks
Alias:
:s -
:no_hardlinks
(Boolean, nil)
— default:
nil
—
force file-copy instead of hardlinks when cloning from a local filesystem
-
:quiet
(Boolean, nil)
— default:
nil
—
suppress progress output to stderr
Alias:
:q -
:verbose
(Boolean, nil)
— default:
nil
—
run verbosely
Alias:
:v -
:progress
(Boolean, nil)
— default:
nil
—
force progress status even when stderr is not a terminal
-
:no_checkout
(Boolean, nil)
— default:
nil
—
skip checking out HEAD after the clone
Alias:
:n -
:bare
(Boolean, nil)
— default:
nil
—
clone as a bare repository
-
:mirror
(Boolean, nil)
— default:
nil
—
set up a mirror clone (implies --bare)
-
:origin
(String)
— default:
nil
—
name of the remote to use instead of "origin"
Alias:
:o -
:branch
(String)
— default:
nil
—
branch to check out after cloning
Alias:
:b -
:revision
(String)
— default:
nil
—
detach HEAD at the given revision after cloning; incompatible with :branch and :mirror
-
:upload_pack
(String)
— default:
nil
—
path to git-upload-pack on the remote (ssh only)
Alias:
:u -
:reference
(String, Array<String>)
— default:
nil
—
borrow objects from one or more reference repositories
-
:reference_if_able
(String, Array<String>)
— default:
nil
—
like :reference but skip with a warning when the reference does not exist
-
:dissociate
(Boolean, nil)
— default:
nil
—
stop borrowing from reference repositories after the clone is complete
-
:separate_git_dir
(String)
— default:
nil
—
place the git directory at the given path and create a gitfile symlink in the working tree
-
:server_option
(String, Array<String>)
— default:
nil
—
protocol-v2 server options
-
:depth
(Integer, String)
— default:
nil
—
create a shallow clone with the specified number of commits
-
:shallow_since
(String)
— default:
nil
—
create a shallow clone with history after the specified date
-
:shallow_exclude
(String, Array<String>)
— default:
nil
—
exclude commits reachable from the specified remote branch or tag
-
:single_branch
(Boolean, nil)
— default:
nil
—
clone only the history for one branch (
--single-branch) -
:no_single_branch
(Boolean, nil)
— default:
nil
—
clone history for all branches (
--no-single-branch) -
:tags
(Boolean, nil)
— default:
nil
—
include tags in the clone (
--tags) -
:no_tags
(Boolean, nil)
— default:
nil
—
exclude tags from the clone (
--no-tags) -
:recurse_submodules
(Boolean, String, Array<String>, nil)
— default:
nil
—
initialize submodules after cloning; pass true for all submodules or a pathspec string/array for a subset
-
:shallow_submodules
(Boolean, nil)
— default:
nil
—
clone submodules with depth 1 (
--shallow-submodules) -
:no_shallow_submodules
(Boolean, nil)
— default:
nil
—
clone submodules with full history (
--no-shallow-submodules) -
:remote_submodules
(Boolean, nil)
— default:
nil
—
use submodule remote-tracking branch status (
--remote-submodules) -
:no_remote_submodules
(Boolean, nil)
— default:
nil
—
use the locally recorded SHA-1 for submodules (
--no-remote-submodules) -
:jobs
(Integer, String)
— default:
nil
—
number of submodules fetched concurrently
Alias:
:j -
:sparse
(Boolean, nil)
— default:
nil
—
enable sparse checkout with top-level files only
-
:reject_shallow
(Boolean, nil)
— default:
nil
—
fail if source is shallow (
--reject-shallow) -
:no_reject_shallow
(Boolean, nil)
— default:
nil
—
allow cloning from shallow sources (
--no-reject-shallow) -
:filter
(String)
— default:
nil
—
specify a partial clone filter (e.g., 'blob:none', 'tree:0')
-
:also_filter_submodules
(Boolean, nil)
— default:
nil
—
apply the partial clone filter to submodules; requires :filter and :recurse_submodules
-
:config
(String, Array<String>)
— default:
nil
—
set configuration variables in the newly-created repository
Alias:
:c -
:bundle_uri
(String)
— default:
nil
—
fetch a bundle from the given URI before fetching from the remote
-
:ref_format
(String)
— default:
nil
—
specify the ref storage format (e.g., 'files', 'reftable')
-
:timeout
(Numeric, nil)
— default:
nil
—
the number of seconds to wait for the command to complete; if nil, uses the global timeout from Git::Config; if 0, no timeout is enforced
-
:chdir
(String, nil)
— default:
nil
—
the working directory in which to run the git clone command
Returns:
-
(Git::CommandLineResult)
—
the result of calling
git clone
Raises:
-
(ArgumentError)
—
if unsupported options are provided
-
(Git::FailedError)
—
if git exits with a non-zero exit status
|
|
# File 'lib/git/commands/clone.rb', line 71
|