There is an article from RStudio explained how to configure Git for RStudio. But it is not very detailed. I ran into many problem during the configuration and wasted a lot of time just for configuration.  So I decided to write down all the steps.

For https connection:

  1. install git
  2. RStudio -> Tools -> Global options -> Git/SVN -> configure the git: C:/Program Files/Git/mingw64/bin/git.exe
  3. RStudio -> Tools -> Project options -> Git/SVN  -> Choose Git
  4. Restart RStudio
  5. In this project, open the Shell: RStudio -> Tools -> Shell, configure your remote repository adress
    git remote add origin https://{username}:{password}@github.com/{username}/project.git
    or https://{username}@github.com/{username}/project.git
    git push -u origin master
  6. Notice: If you already setted the adress, you can change it with:
    git remote set-url origin https://{username}:{password}@github.com/{username}/project.git

For ssh connection:

  • do the same 1 to 4 steps like the https connection.
  • open shell: git remote add origin git@github.com/{username}/project.git
  • generate SSH key: Tools -> Global options -> Git/SVN -> SSH RSA Key -> Generate RSA Key
  • view public key -> copy it
  • Open your github etc repositories -> add the public key to your account
  • If you installed the Putty, you will get a big problem, the RStudio can not find the ssh.exe, So you have to specify the ssh path:
    set the evironment variable: systemsteuerung -> system und sicherheit -> system -> erweiterted Systemeinstellungen -> Erweitert -> Umgebungsvariablen -> “GIT_SSH”: C:\Program Files\Git\usr\bin\ssh.exe

There are several useful links for the configuration problems:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.