def _clone_project(project_name):
gh = Github()
(gh_repo, forked) = gh.get_repo(project_name, fork=True)
if not gh_repo:
click.echo('error: no repository named %s was found on '
'your user and configured organizations' %
click.style(project_name, bold=True))
sys.exit(1)
if forked:
click.echo('We found a repository named %s and forked it to your '
'user, it now accessible at the following url:\n'
'%s' % (forked.full_name, gh_repo.html_url))
dest_path = os.path.join(projects_path(), project_name)
click.echo('We will clone %s in %s\n' % (gh_repo.ssh_url, dest_path))
vgit('clone', gh_repo.ssh_url, dest_path)
# add our upstream remote
if gh_repo.parent:
repo = Repo(dest_path)
repo.create_remote('upstream', gh_repo.parent.ssh_url)
评论列表
文章目录