use_github() takes a local project, creates an associated repo on GitHub, adds it to your local repo as the origin remote, and makes an initial push to synchronize. use_github() requires that your project already be a Git repository, which you can accomplish with use_git(), if needed. See the Authentication section below for other necessary setup.

  organisation = NULL,
  private = FALSE,
  protocol = git_protocol(),
  credentials = NULL,
  auth_token = github_token(),
  host = NULL



If supplied, the repo will be created under this organisation, instead of the account of the user associated with the auth_token. You must have permission to create repositories.


If TRUE, creates a private repository.


Optional. Should be "ssh" or "https", if specified. Defaults to the option usethis.protocol and, if unset, to an interactive choice or, in non-interactive sessions, "ssh". NA triggers the interactive menu.


A git2r credential object produced with git2r::cred_env(), git2r::cred_ssh_key(), git2r::cred_token(), or git2r::cred_user_pass().


GitHub personal access token (PAT).


GitHub API host to use. Override with the endpoint-root for your GitHub enterprise instance, for example, "".


A new GitHub repo will be created via the GitHub API, therefore you must make a GitHub personal access token (PAT) available. You can either provide this directly via the auth_token argument or store it for retrieval with github_token().


if (FALSE) { pkgpath <- file.path(tempdir(), "testpkg") create_package(pkgpath) # creates package below temp directory proj_set(pkgpath) ## now, working inside "testpkg", initialize git repository use_git() ## create github repository and configure as git remote use_github() }