14.3 Create a project in RStudio and commit a file
Next, return to RStudio and configure Git via the Terminal (Figure 14.3A)). Remember Git is a piece of software running on your own computer. This is distinct to GitHub, which is the repository website.
We will now create a new project which we want to backup to GitHub.
In RStudio, click New project as normal (Figure 14.3B). Click New Directory. Name the project and check Create a git repository. Now in RStudio, create a new script which you will add to your repository.
After saving your new script (e.g., test.R), it should appear in the Git tab beside Environment.
Tick the file you wish to add, and the status should turn to a green ‘A’ (Figure 14.3C). Now click Commit and enter an identifying message in Commit message (Figure 14.3D). It makes sense to do this prior to linking the project and the GitHub repository, otherwise you’ll have nothing to push to GitHub.
You have now committed the current version of this file to a Git repository on your computer/server.