install.packages("gitcreds")5 GithHub + RStudio
Happy Git and GitHub for the useR is a great resource for connecting Git/GitHub and RStudio.
5.1 Lab Specific Git + RStudio Communication
- Generate token
- Log into https://github.com/
- Go to https://github.com/settings/tokens
- Press
Generate new token - Select
Generate New Token (Fine-grained, repo-scoped)from the dropdown menu - Create token name
- No description
- Select expiration
- Keep public repositories
- Don’t add any permissions
- Click
generate token
Copy token to computer (notes, word, password organizer, etc…)
Enter GitHub Token into R
- Check if the “gitcreds” package is installed
- at the prompt in the Console type ‘gitcreds()’
- if an Error is received, please install package
- at the prompt in the Console type ‘gitcreds()’
- Add your token to R
- in the console at the prompt
>run the command below
- in the console at the prompt
gitcreds::gitcreds_set()Paste token when prompted
To check if this worked run “gitcreds::gitcreds_get()”
also make sure you have packages
rmarkdownandknitrby searching in packages
Create a New Project in RStudio from an existing project on GitHub
Clone Repository
Create a branch in GitHub
For each GitHub repository you will be working on in the lab that is shared among others, you will need to create your own Branch.
Please create your own branch directly in the repository on the GitHub site