Repository navigation
Expand file tree
/
Copy pathuse_github.Rd
More file actions
66 lines (58 loc) · 2.43 KB
/
Copy pathuse_github.Rd
File metadata and controls
66 lines (58 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/infrastructure-git.R
\name{use_github}
\alias{use_github}
\title{Connect a local repo with GitHub.}
\usage{
use_github(auth_token = github_pat(), private = FALSE, pkg = ".",
protocol = c("ssh", "https"))
}
\arguments{
\item{auth_token}{To install from a private repo, generate a personal
access token (PAT) in \url{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. Defaults to
the \code{GITHUB_PAT} environment variable.}
\item{private}{If \code{TRUE}, creates a private repository.}
\item{pkg}{Path to package. See \code{\link{as.package}} for more
information.}
\item{protocol}{transfer protocol, either "ssh" (the default) or "https"}
}
\description{
If the current repo does not use git, calls \code{\link{use_git}}
automatically. \code{\link{use_github_links}} is called to populate the
\code{URL} and \code{BugReports} fields of DESCRIPTION.
}
\section{Authentication}{
A new GitHub repo will be created via the GitHub API, therefore you must
provide a GitHub personal access token via the argument \code{auth_token},
which defaults to the value of the \code{GITHUB_PAT} environment variable.
Obtain a personal access token from
\url{https://github.com/settings/applications}.
The argument \code{protocol} reflects how you wish to authenticate with
GitHub for this repo in the long run. For either \code{protocol}, a remote
named "origin" is created, an initial push is made using the specified
\code{protocol}, and a remote tracking branch is set. The URL of the
"origin" remote has the form \code{git@github.com:<USERNAME>/<REPO>.git}
(\code{protocol = "ssh"}, the default) or
\code{https://github.com/<USERNAME>/<REPO>.git} (\code{protocol =
"https"}). For \code{protocol = "ssh"}, it is assumed that public and
private keys are in the default locations, \code{~/.ssh/id_rsa.pub} and
\code{~/.ssh/id_rsa}, respectively, and that \code{ssh-agent} is configured
to manage any associated passphrase.
}
\examples{
\dontrun{
## to use default ssh protocol
create("testpkg")
use_github(pkg = "testpkg")
## or use https
create("testpkg2")
use_github(pkg = "testpkg2", protocol = "https")
}
}
\seealso{
Other git infrastructure: \code{\link{use_git_hook}};
\code{\link{use_github_links}}; \code{\link{use_git}}
}
\keyword{internal}