Skip to content

Commit ec1b15d

Browse files
committed
Refresh the "double auth" roxygen template
Closes #1306
1 parent efc8b96 commit ec1b15d

File tree

7 files changed

+88
-134
lines changed

7 files changed

+88
-134
lines changed

R/create.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ create_project <- function(path,
113113
#' [pr_init()], one of several [functions that work pull
114114
#' requests][pull-requests].
115115
#'
116-
#' `create_from_github()` works best when we can find a GitHub personal access
117-
#' token in the Git credential store (just like many other usethis functions).
118-
#' See [gh_token_help()] for more advice.
116+
#' `create_from_github()` works best when your GitHub credentials are
117+
#' discoverable. See below for more about authentication.
118+
#'
119+
#' @template double-auth
119120
#'
120121
#' @seealso
121122
#' * [use_github()] to go the opposite direction, i.e. create a GitHub repo
@@ -124,8 +125,6 @@ create_project <- function(path,
124125
#' * [use_course()] to download a snapshot of all files in a GitHub repo,
125126
#' without the need for any local or remote Git operations
126127
#'
127-
#' @template double-auth
128-
#'
129128
#' @inheritParams create_package
130129
#' @param repo_spec A string identifying the GitHub repo in one of these forms:
131130
#' * Plain `OWNER/REPO` spec

R/github.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#' * Configures `origin/DEFAULT` to be the upstream branch of the local
1515
#' `DEFAULT` branch, e.g. `master` or `main`
1616
#'
17-
#' See the Authentication section below for general setup that is necessary for
18-
#' all of this to work.
17+
#' See below for the authentication setup that is necessary for all of this to
18+
#' work.
1919
#'
2020
#' @template double-auth
2121
#'

R/pr.R

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,7 @@
2525
#' The `pr_*` functions also use your Git/GitHub credentials to carry out
2626
#' various remote operations. See below for more.
2727
#'
28-
#' @section Git/GitHub credentials:
29-
#' The `pr_*` functions interact with GitHub both as a conventional Git remote
30-
#' and via the REST API. Therefore, your credentials must be discoverable. Which
31-
#' credentials do we mean?
32-
#' * A GitHub personal access token (PAT) must be discoverable by the gh
33-
#' package, which is used for GitHub operations via the REST API. See
34-
#' [gh_token_help()] for more about getting and configuring a PAT.
35-
#' * If you use the HTTPS protocol for Git remotes, your PAT is also used for
36-
#' Git operations, such as `git push`. Usethis uses the gert package for this,
37-
#' so the PAT must be discoverable by gert. Generally gert and gh will
38-
#' discover and use the same PAT. This ability to "kill two birds with one
39-
#' stone" is why HTTPS + PAT is our recommended auth strategy for those new
40-
#' to Git and GitHub and PRs.
41-
#' * If you use SSH remotes, your SSH keys must also be discoverable, in
42-
#' addition to your PAT. The public key must be added to your GitHub account.
43-
#'
44-
#' Git/GitHub credential management is covered in a dedicated article:
45-
#' [Managing Git(Hub) Credentials](https://usethis.r-lib.org/articles/articles/git-credentials.html)
28+
#' @template double-auth
4629
#'
4730
#' @section For contributors:
4831
#' To contribute to a package, first use `create_from_github("OWNER/REPO")` to

man/create_from_github.Rd

Lines changed: 23 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/pull-requests.Rd

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
1-
#' @section Authentication:
2-
#' This function potentially interacts with GitHub in two different ways:
3-
#' * via the GitHub REST API
4-
#' * as a conventional Git remote
5-
#'
6-
#' Therefore two types of auth happen.
7-
#'
1+
#' @section Git/GitHub Authentication:
82

9-
#' To create a new repo on GitHub, we **must** call the GitHub REST API, i.e.
10-
#' this isn't one of the standard remote Git operations. Therefore you must make
11-
#' a GitHub personal access token (PAT) available. See [gh_token_help()] for
12-
#' advice on getting and storing your token.
13-
#'
3+
#' Many usethis functions, including those documented here, potentially interact
4+
#' with GitHub in two different ways:
145

15-
#' When we clone or pull from GitHub or push to it, depending on the protocol
16-
#' (HTTPS vs. SSH) and the privacy of the repo, we may also need regular Git
17-
#' credentials, just like we'd need with command line Git.
18-
#'
19-
#' We highly recommend using the HTTPS protocol, unless you have a specific
20-
#' preference for SSH. If you are an "HTTPS person", your GitHub PAT (see above)
21-
#' can also be used to authorize standard Git remote operations. Therefore, once
22-
#' you've configured your PAT, your setup is complete!
6+
#' * Via the GitHub REST API. Examples: create a repo, a fork, or a pull
7+
#' request.
8+
9+
#' * As a conventional Git remote. Examples: clone, fetch, or push.
2310
#'
2411

25-
#' But what if you prefer the SSH protocol? usethis uses the gert package for
26-
#' Git operations and gert, in turn, relies on the credentials package for auth:
27-
#' * <https://docs.ropensci.org/gert/>
28-
#' * <https://docs.ropensci.org/credentials/>
12+
#' Therefore two types of auth can happen and your credentials must be
13+
#' discoverable. Which credentials do we mean?
2914
#'
3015

31-
#' In usethis v2.0.0, we switched from git2r to gert + credentials. The main
32-
#' motivation is to provide a smoother user experience by discovering and using
33-
#' the same credentials as command line Git (and, therefore, the same as
34-
#' RStudio). The credentials package *should* automatically discover your SSH
35-
#' keys. This works so well that we have removed all credential-handling
36-
#' workarounds from usethis. If you have credential problems, focus your
37-
#' troubleshooting on getting the credentials package to find your SSH keys. Its
38-
#' [introductory
39-
#' vignette](https://docs.ropensci.org/credentials/articles/intro.html)
40-
#' is a good place to start.
16+
#' * A GitHub personal access token (PAT) must be discoverable by the gh
17+
#' package, which is used for GitHub operations via the REST API. See
18+
#' [gh_token_help()] for more about getting and configuring a PAT.
19+
20+
#' * If you use the HTTPS protocol for Git remotes, your PAT is also used for
21+
#' Git operations, such as `git push`. Usethis uses the gert package for this,
22+
#' so the PAT must be discoverable by gert. Generally gert and gh will
23+
#' discover and use the same PAT. This ability to "kill two birds with one
24+
#' stone" is why HTTPS + PAT is our recommended auth strategy for those new
25+
#' to Git and GitHub and PRs.
26+
#' * If you use SSH remotes, your SSH keys must also be discoverable, in
27+
#' addition to your PAT. The public key must be added to your GitHub account.
28+
#'
29+
#' Git/GitHub credential management is covered in a dedicated article:
30+
#' [Managing Git(Hub) Credentials](https://usethis.r-lib.org/articles/articles/git-credentials.html)

man/use_github.Rd

Lines changed: 23 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)