'Clone the specified repository
Args:
repository [string]: The name of the github repository (without owner).
owner [string]: An explicit repository owner.
If not provided use the configured options.'

def git_clone(self, repository, owner=None):

    name = repository.name
    repository_dir = get_repository_dir(name)
    upstream_user = repository.owner
    branch = (self.pull_branch or 'master')
    origin_url = self.get_github_repository_url(repository, owner=owner)
    upstream_url = 'https://github.com/{upstream_user}/{name}.git'.format(upstream_user=upstream_user, name=name)
    print 'Cloning    {name}    from    {origin_url}    -b    {branch}.'.format(name=name, origin_url=origin_url, branch=branch)
    shell_result = run_and_monitor('git    clone    {url}    -b    {branch}'.format(url=origin_url, branch=branch), echo=False)
    if (not shell_result.returncode):
        if shell_result.stdout:
            print shell_result.stdout
    else:
        if (repository in self.__extra_repositories):
            sys.stderr.write('WARNING:    Missing    optional    repository    {name}.\n'.format(name=name))
            sys.stderr.write('                                    Continue    on    without    it.\n')
            return
        sys.stderr.write((shell_result.stderr or shell_result.stdout))
        sys.stderr.write('FATAL:    Cannot    continue    without    required    repository    {name}.\n                            Consider    using    github    to    fork    one    from    {upstream}.\n'.format(name=name, upstream=upstream_url))
        raise SystemExit('Repository    {url}    not    found.'.format(url=origin_url))
    if (self.__options.add_upstream and (origin_url != upstream_url)):
        print '        Adding    upstream    repository    {upstream}.'.format(upstream=upstream_url)
        check_run_quick('git    -C    "{dir}"    remote    add    upstream    {url}'.format(dir=repository_dir, url=upstream_url), echo=False)
    if self.__options.disable_upstream_push:
        which = ('upstream' if (origin_url != upstream_url) else 'origin')
        print '        Disabling    git    pushes    to    {which}    {upstream}'.format(which=which, upstream=upstream_url)
        check_run_quick('git    -C    "{dir}"    remote    set-url    --push    {which}    disabled'.format(dir=repository_dir, which=which), echo=False)
