Clone a repo into the repos folder.

@param string $repo
@param string $cloneUrl
@param string $newRepoHome
@param string $upstreamUsername The upstream vendor name of the repo if available.
764787
private function cloneRepo($repo, $cloneUrl, $newRepoHome, $upstreamUsername)
    {
        $this->outputSuccess("{$repo}: cloning {$cloneUrl} ...");
        $this->getGitWrapper()->cloneRepository($cloneUrl, $newRepoHome);
        
        if (!empty($upstreamUsername)) {
            $this->getGitWrapper()->git('remote add upstream https://github.com/'.$upstreamUsername.'/'.$repo.'.git', $newRepoHome);
            $this->outputInfo("{$repo}: Configure upstream https://github.com/{$upstreamUsername}/{$repo}.git ✔");
        }
        
        $this->outputSuccess("{$repo}: cloning ✔");
    }
556473
public function repoList($repo, $path = null, $ref = null)
    {
        $src = $this->client->api('Repositories\Src');
        /** @var \Buzz\Message\Response $response */
        $response = $this->checkResponse($src->get($this->username, $repo, $ref, $path));

        return $this->cleanSrcList(json_decode($response->getContent(), true));
    }
273982
function cloneFromGit(hostInfo, root, ssh) {
  const branch = hostInfo.committish ? `-b ${hostInfo.committish}` : '';
  let url;

  if (ssh) {
    url = hostInfo.ssh({noCommittish: true});
  } else {
    url = hostInfo.https({noCommittish: true, noGitPlus: true});
  }

  console.log(`Cloning theme from a git repo: ${chalk.green(url)}`);

  return utils
    .spawn(`git clone ${branch} ${url} "${root}" --single-branch`, {
      stdio: 'pipe',
    })
    .then(() => {
      return fs.remove(path.join(root, '.git'));
    })
    .catch((error) => {
      console.log();
      console.log(chalk.red('There was an error while cloning the git repo:'));
      console.log('');
      console.log(chalk.red(error));

      process.exit(1);
    });
}
1004677
public function createRepo(string $repo = null)
    {
        $end = $this->getVendorType() === 'org'
            ?'/orgs/' . $this->getVendor() . '/repos'
            : '/user/repos'
        ;
        $res = $this->request('POST', $end, [
            'name'        => $this->getName(),
            'description' => $this->getDescription(),
        ]);
        if (Helper::isResponseOk($res)) {
            echo "\ngit remote add origin git@github.com:{$this->getFullName()}.git\n";
            echo "git push -u origin master\n";
        }

        return $res;
    }
1148584
def clone_repo(pkg_name, repo_url):
    """"""
    new_repo = ClonedRepo(name=pkg_name, origin=repo_url)
    new_repo.save()
    return new_repo
1308335
public function cloneRepository($remote)
    {
        $fileSystem = new Filesystem();
        $fileSystem->mkdir($this->directory);

        if ($fileSystem->exists($this->directory.DIRECTORY_SEPARATOR.'.git')) {
            throw new \RuntimeException(sprintf('"%s" already is a git repository.', $this->directory));
        }

        return $this->executeCmd(sprintf(
            self::CMD_GITCLONE,
            $remote,
            $this->directory
        ));
    }
620465
function copyRepo(dest) {
  return new Promise((resolve, reject) => {
    ncp('.tmp/repo', dest, (err) => {
      if (err) {
        reject(err)
        return
      }
      resolve()
    })
  })
}
41516
public function create($owner, $repo, $content, $encoding = 'utf-8')
	{
		// Build the request path.
		$path = '/repos/' . $owner . '/' . $repo . '/git/blobs';

		$data = array(
			'content'  => $content,
			'encoding' => $encoding
		);

		return $this->processResponse(
			$this->client->post($this->fetchUrl($path), json_encode($data)),
			201
		);
	}
1373411
protected function cloneBySsh(Builder $builder, $cloneTo)
    {
        $keyFile = $this->writeSshKey();

        // Do the git clone:
        $cmd = 'hg clone --ssh "ssh -i '.$keyFile.'" %s "%s"';
        $success = $builder->executeCommand($cmd, $this->getCloneUrl(), $cloneTo);

        if ($success) {
            $success = $this->postCloneSetup($builder, $cloneTo);
        }

        // Remove the key file:
        unlink($keyFile);
        return $success;
    }
424193
function cloneGitRepo(host, ref) {
    var isBranch = false;

    ref = ref || 'master';
    if (!validateSha(ref)) isBranch = true;

    return Q()

    // Create temporary folder to store git repos
    .then(function() {
        if (GIT_TMP) return;
        return fs.tmp.dir()
            .then(function(_tmp) {
                GIT_TMP = _tmp;
            });
    })

    // Return or clone the git repo
    .then(function() {
        // Unique ID for repo/ref combinaison
        var repoId = crc.crc32(host+'#'+ref).toString(16);

        // Absolute path to the folder
        var repoPath = path.resolve(GIT_TMP, repoId);

        return fs.exists(repoPath)
            .then(function(doExists) {
                if (doExists) return;

                // Clone repo
                return exec('git clone '+host+' '+repoPath)
                .then(function() {
                    return exec('git checkout '+ref, { cwd: repoPath });
                });
            })
            .thenResolve(repoPath);
    });
}
1266375
function git_clone_platform(git_url, branch) {
    // Create a tmp dir. Using /tmp is a problem because it's often on a different partition and sehll.mv()
    // fails in this case with "EXDEV, cross-device link not permitted".
    var tmp_subidr = 'tmp_cordova_git_' + process.pid + '_' + (new Date()).valueOf();
    var tmp_dir = path.join(util.libDirectory, 'tmp', tmp_subidr);
    shell.rm('-rf', tmp_dir);
    shell.mkdir('-p', tmp_dir);

    return HooksRunner.fire('before_platform_clone', {
        repository: git_url,
        location: tmp_dir
    }).then(function () {
        var branchToCheckout = branch || 'master';
        return gitclone.clone(git_url, branchToCheckout, tmp_dir);
    }).then(function () {
        HooksRunner.fire('after_platform_clone', {
            repository: git_url,
            location: tmp_dir
        });
        return tmp_dir;
    }).fail(function (err) {
        shell.rm('-rf', tmp_dir);
        return Q.reject(err);
    });
}
1087439
public void cloneTo(File newRepoDir, GitRepositoryFormat format) {
        cloneTo(newRepoDir, format, (current, total) -> { /* no-op */ });
    }
787628
public function cloneRepo($url, $branch = NULL, $dir = NULL)
	{
		$command = "clone";
		$command .= " --depth 1 --recursive $url";
		$command .= ($branch ? " --branch $branch" : '');
		$command .= ($dir ? ' ' . escapeshellarg($dir) : '');
		$this->setCommand($command);
	}
460258
function clone(url, target, ref, key, log, fn) {
  var urlObj = parseurl(url);
  urlObj.auth = key + ':x-oauth-basic';
  var authurl = formaturl(urlObj) + '.git';

  var dir = target + '/.git';

  log('creating dir ' + dir);
  mkdirp(dir, function(err) {
    if (err) return fn(err);

    var remote = git.remote(authurl);
    var repo = git.repo(dir);
    var opts = {};
    opts.want = ref;
    log('fetching ' + url);
    repo.fetch(remote, opts, function(err) {
      if (err) return fn(err);
      log('checking out ' + ref);
      repo.resolveHashish(ref, function(err, hash) {
        if (err) return fn(err);
        log('updating head to ' + hash);
        repo.updateHead(hash, function(err) {
          if (err) return fn(err);
          exec('git checkout ' + hash, {cwd: target}, function(err, stdout, stderr) {
            fn(err);
          });
        });
      });
    });
  });
}
839646
public function actionRemove($repo)
    {
        FileHelper::removeDirectory($this->getFilesystemRepoPath($repo));
        $clones = $this->getConfig(self::CONFIG_VAR_CUSTOMCLONES, []);
        if (isset($clones[$repo])) {
            unset($clones[$repo]);
            $this->saveConfig(self::CONFIG_VAR_CUSTOMCLONES, $clones);
        }
        
        return $this->outputSuccess("Removed repo {$repo}.");
    }
595771
def re_clone(self, repo_dir):
        """"""
        self.git('clone', self.remote_url, repo_dir)
        return GitRepo(repo_dir)
141869
public void cloneTo(File newRepoDir, BiConsumer<Integer, Integer> progressListener) {
        cloneTo(newRepoDir, GitRepositoryFormat.V1, progressListener);
    }