Creates a new local Git repository from a repository on GitHub. It is highly
recommended that you pre-configure or pass a GitHub personal access token
(PAT), which is facilitated by browse_github_pat()
. In particular, a PAT is
required in order for create_from_github()
to do "fork and clone". It is also required
by use_github()
, which connects existing local projects to GitHub.
use_github()
has more detailed advice on working with the protocol
and
credentials
arguments.
create_from_github(repo_spec, destdir = NULL, fork = NA, rstudio = NULL, open = interactive(), protocol = getOption("usethis.protocol", default = "ssh"), credentials = NULL, auth_token = NULL, host = NULL)
repo_spec | GitHub repo specification in this form: |
---|---|
destdir | The new folder is stored here. Defaults to user's Desktop. |
fork | If |
rstudio | Initiate an RStudio Project?
Defaults to |
open | If |
protocol | transfer protocol, either "ssh" (the default) or "https".
You can supply a global default with |
credentials | A |
auth_token | Provide a personal access token (PAT) from
https://github.com/settings/tokens. If |
host | GitHub API host to use. Override with the endpoint-root for your GitHub enterprise instance, for example, "https://github.hostname.com/api/v3" |
use_github()
for GitHub setup advice. use_course()
for one-time
download of all files in a Git repo, without any local or remote Git
operations.
# NOT RUN { create_from_github("r-lib/usethis") create_from_github("r-lib/usethis", protocol = "https") ## various ways code can look when specifying ssh credential explicitly create_from_github("r-lib/usethis", credentials = git2r::cred_ssh_key()) cred <- git2r::cred_ssh_key( publickey = "path/to/id_rsa.pub", privatekey = "path/to/id_rsa" ) create_from_github("cran/TailRank", credentials = cred) # }