-
Notifications
You must be signed in to change notification settings - Fork 60
/
git-cred.R
45 lines (27 loc) · 1.66 KB
/
git-cred.R
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
#### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
### 2. Configure git with Rstudio ############################################
install.packages(c("usethis", "credentials"))
## set your user name and email:
usethis::use_git_config(user.name = "PUT IN YOUR GIT USER NAME", user.email = "PUT IN THE EMAIL ASSOCIATED WITH GIT")
# ----------------------------------------------------------------------------
### 3. Configure github with Rstudio ############################################
## create a personal access token for authentication:
usethis::create_github_token()
## set personal access token:
credentials::set_github_pat()
# ----------------------------------------------------------------------------
#### 4. Restart R! ###########################################################
# ----------------------------------------------------------------------------
#### 5. Verify settings ######################################################
usethis::git_sitrep()
## Your username and email should be stated correctly in the output.
## Also, the report should contain something like:
## 'Personal access token: '<found in env var>''
## If you are still having troubles, read the output carefully.
## It might be that the PAT is still not updated in your `.Renviron` file.
## Call `usethis::edit_r_environ()` to update that file manually.
# ----------------------------------------------------------------------------
# SOURCE: https://gist.github.com/Z3tt/3dab3535007acf108391649766409421