Your team project lives in a public GitHub repository. This guide takes you from nothing to your first push from RStudio. It takes about 30 minutes. Do it before Milestone 1 (GitHub repository), due Sunday, October 11. Each step links to the matching chapter of Happy Git and GitHub for the useR if you want more detail.
Go to github.com and sign up. Pick a username you would be happy to put on a CV, and verify your email address. (More detail)
git --version. If Git is not installed, macOS offers to install the Command Line Developer Tools. Accept.Restart RStudio afterwards. (More detail)
Run this in the RStudio Console, with your name and the email of your GitHub account:
install.packages("usethis")
usethis::use_git_config(user.name = "Your Name", user.email = "you@example.com")
GitHub does not accept your password from RStudio. It needs a token instead.
usethis::create_github_token()
A GitHub page opens. Add a note such as “PBA laptop”, keep the default scopes, set the expiration to a date after the end of the semester, click Generate token, and copy the token. Then run
gitcreds::gitcreds_set()
and paste the token when asked. (More detail)
In RStudio, go to Tools > Global Options > Git/SVN. The Git executable box should show a path. If it is empty, restart RStudio, or point it to the Git you installed in step 2. (More detail)
Do not put the project inside Dropbox, iCloud Drive, OneDrive, or Google Drive. The sync tool and Git both try to manage the same files, and the repository can break.
C:\projects instead./Users/yourname/projects.pba-project- followed by your team name (lowercase, hyphens instead of spaces), choose Public, and check Add a README file.A Git tab now appears in the upper-right pane. (More detail)
README.md and add a line with your name. The first person can also add the team name and one or two sentences on topic ideas.Working with teammates: click Pull (the blue down arrow) before you start working, and push when you finish. This avoids most conflicts.
GitHub rejects files larger than 100 MB. Put raw data in a folder such as data/raw/, tell Git to ignore it, and write in the README where the data can be downloaded:
usethis::use_git_ignore("data/raw/")
If you already committed a large file, run git rm --cached path/to/the/file in the RStudio Terminal tab, then commit and push again.
Submit your team repository’s URL on eeclass by Sunday, October 11. Before you submit, check that every team member has pushed at least one commit.
usethis::use_git() in the Console also works.More help: the troubleshooting chapter of Happy Git, the eeclass discussion board, or your TA.