devtools (version 1.9.1)

use_github: Connect a local repo with GitHub.

Description

If the current repo does not use git, calls use_git automatically. use_github_links is called to populate the URL and BugReports fields of DESCRIPTION.

Usage

use_github(auth_token = github_pat(), private = FALSE, pkg = ".",
  protocol = c("ssh", "https"))

Arguments

auth_token
To install from a private repo, generate a personal access token (PAT) in https://github.com/settings/applications and supply to this argument. This is safer than using a password because you can easily delete a PAT without affecting any others
private
If TRUE, creates a private repository.
pkg
Path to package. See as.package for more information.
protocol
transfer protocol, either "ssh" (the default) or "https"

Authentication

A new GitHub repo will be created via the GitHub API, therefore you must provide a GitHub personal access token via the argument auth_token, which defaults to the value of the GITHUB_PAT environment variable. Obtain a personal access token from https://github.com/settings/applications.

The argument protocol reflects how you wish to authenticate with GitHub for this repo in the long run. For either protocol, a remote named "origin" is created, an initial push is made using the specified protocol, and a remote tracking branch is set. The URL of the "origin" remote has the form git@github.com:/.git (protocol = "ssh", the default) or https://github.com//.git (protocol = "https"). For protocol = "ssh", it is assumed that public and private keys are in the default locations, ~/.ssh/id_rsa.pub and ~/.ssh/id_rsa, respectively, and that ssh-agent is configured to manage any associated passphrase.

See Also

Other git infrastructure: use_git_hook; use_github_links; use_git

Examples

Run this code
## to use default ssh protocol
create("testpkg")
use_github(pkg = "testpkg")

## or use https
create("testpkg2")
use_github(pkg = "testpkg2", protocol = "https")

Run the code above in your browser using DataCamp Workspace