clone method

  1. @override
Future<GitWorkingRepository> clone(
  1. String source,
  2. String target, {
  3. bool noCheckout = false,
  4. String? branch,
})
inherited

Clones the repository source into the directory target, and opens the clone as a GitWorkingRepository.

source is a remote location in one of the accepted forms documented on this class. noCheckout leaves an empty work tree, holding only the git directory; branch checks out that branch instead of source's own HEAD.

A path is always treated as a path, even when it is spelled like an option. Every other failure — an unreadable source, an existing and non-empty target — is a GitException.

Throws GitUnsupportedUrlException without running git when source is not in an accepted form, GitAuthenticationException when the remote refused or demanded credentials, GitRemoteUnreachableException when the remote host could not be reached, and GitRemoteRepositoryNotFoundException when no repository exists at source.

Implementation

@override
Future<GitWorkingRepository> clone(
  String source,
  String target, {
  bool noCheckout = false,
  String? branch,
}) async {
  await _clone(source, target, noCheckout: noCheckout, branch: branch);
  return openWorking(target);
}