Skip to content

Instantly share code, notes, and snippets.

@rpodcast
Last active October 21, 2024 16:12
Show Gist options
  • Save rpodcast/8ec9a12bb00f1d94d7bf876e439b872c to your computer and use it in GitHub Desktop.
Save rpodcast/8ec9a12bb00f1d94d7bf876e439b872c to your computer and use it in GitHub Desktop.
R/Pharma Diversity Hackathon Git Setup
### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
### 2. Create Fork of Project Github Repsoitory #############################
## Visit the GitHub repository link of the project
## Click the "Fork" button to create a new fork of the repository under your GitHub account
## Copy the URL of your fork of the repository for step (X)
### 3. 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")
# ----------------------------------------------------------------------------
### 4. Configure github with Rstudio ############################################
## create a personal access token for authentication:
usethis::create_github_token()
## set personal access token:
credentials::set_github_pat()
# ----------------------------------------------------------------------------
#### 5. Restart R! ###########################################################
## In RStudio: Go to Session -> Restart R
# ----------------------------------------------------------------------------
#### 6. 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.
# ----------------------------------------------------------------------------
#### 7. Update GitHub address link to point to your fork of the repository
usethis::use_git_remote(
name = "origin",
url = "PUT IN GITHUB FORK REPOSITORY URL",
overwrite = TRUE
)
# SOURCE: https://gist.github.com/rpodcast/8ec9a12bb00f1d94d7bf876e439b872c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment