RStudio - Configure Git
Configure you ssh keys
In case you're using Git for the first time in RStudio, you will need to create your ssh key in the Tools > Global Options Menu :
Once created, you can view the corresponding public key to add it to your hosting provider (Github, Gitlab...) in order to be able to push your code to these remote repositories.
In case ssh-keygen is not available in your platform you can ask an admin to install it with the folowwing commands :
sudo apt-get update
sudo apt-get -y install openssh-client
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