Create a project from an existing repository
When creating a project from scratch in RStudio, you can choose to create it from an existing Git repository :
You will then be asked about your repository information :
Configure an existing repository
If your project already exists but is not versionned with Git, you can still choose to do so by going in your Project settings :
and choosing Git as your Version control system :
You can then link this local Git repository to an existing remote repository with the following command (inside the Terminal):
git remote add origin https://github.com/<>/my-rstudio-project.git
Now you can do your first commit :
If your remote repository hasn't been initialized yet, you will need to push your first commits within the terminal with the following command :
git push -u origin master
More information can be found in the official documentation