Learn R Programming

usethis (version 1.2.0)

create_from_github: Create a repo and project from GitHub

Description

Creates a new local Git repository from a repository on GitHub. If you have pre-configured a GitHub personal access token (PAT) as described in gh::gh_whoami(), you will get more sensible default behavior for the fork argument. You cannot create a fork without a PAT. Currently only works for public repositories. A future version of this function will likely have an interface closer to use_github(), i.e. more ability to accept credentials and more control over the Git configuration of the affected remote or local repositories.

Usage

create_from_github(repo, destdir = NULL, fork = NA, rstudio = NULL,
  open = interactive())

Arguments

repo

GitHub repo specification in this form: owner/reponame. The second part will be the name of the new local repo.

destdir

The new folder is stored here. Defaults to user's Desktop.

fork

Create and clone a fork? Or clone repo itself? Defaults to TRUE if you can't push to repo, FALSE if you can.

rstudio

Initiate an RStudioProject? Defaults to TRUE if in an RStudio session and project has no pre-existing .Rproj file. Defaults to FALSE otherwise.

open

If TRUE and in RStudio, new project will be opened in a new instance, if possible, or will be switched to, otherwise. If TRUE and not in RStudio, working directory will be set to the new project.

See Also

use_course() for one-time download of all files in a Git repo, without any local or remote Git operations.

Examples

Run this code
# NOT RUN {
create_from_github("r-lib/usethis")
# }

Run the code above in your browser using DataLab