|
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: |
8 | 2 |
|
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: |
14 | 5 |
|
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. |
23 | 10 | #' |
24 | 11 |
|
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? |
29 | 14 | #' |
30 | 15 |
|
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) |
0 commit comments