Step-by-step instructions how to setup an RStudio Project with a connected GitHub Repository
.thumbnail { padding: 0px!important; margin: 0px!important; max-width: 10%!important; height: auto!important; vertical-align: text-top!important; }
It took me a while to figure out how to set it up so that an RStudio Project is linked to a GitHub repository, even though it is rather easy in the end.
So I wanted to write it down here - either for a forgetful future-me but maybe it can also help someone else in the same situation.
The necessary steps involved are:
And the step-by-step goes as follows:
Create any kind of new RStudio Project, nothing special here.
Under Tools > Project Options > Git/SVN choose Git as version control system, and restart RStudio when prompted:
Afterwards Git should be selected as version control, and Origin set to ‘none’:
Create a new GitHub repository, but do not include a readme, a .gitignore file or a license file!
This point is crucial as this would make it so that these files are available in the repository but not in your the RStudio Project and this difference in file will then create a bunch of complications which we then would need to solve. Better not go there in the first place.
So it should look like this when setting up the repository:
If done correctly you should be rewared with a screen with instructions needed for the final step:
And finally in order to link the Rstudio Project to the GitHub repository open a terminal window in RStudio (not the console) and enter the commands shown above:
There you go, from now on you can commit changes to Git and also push/pull to and from GitHub.