In the spirit of documenting new git things I am learning (see my pull request post here), I thought I would walk through how to turn a project that lives on your machine into a git repo. I am walking through the instructions in happygitwithr.com and there is a reason that there first two use cases Jenny Bryan lays out both involve starting with a repo on Github first
Step 1: launch your project file - if your things don’t live in a project you can usethis::create_project()
Step 2: tell Rstudio you want to use git
usethis::use_git(message = "initial commit"))
Note this is equivalent to
git init in the terminal. If you get a message asking whether commit the files usethis finds, you can say ‘Yup’. Otherwise, take a look at the git tab and see if there is anything to commit.
Step 3: tell RStudio you want to connect to github
usethis also makes this step easy, provided you have created a Github Personal Access Token (PAT)