Skip to content

Commit

Permalink
Refresh 'Detect Git from RStudio'
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jan 8, 2019
1 parent 191fbcc commit 074734a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions 14_connect-can-rstudio-use-git.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

If you want RStudio to help with your Git and GitHub work, it must be able to find the Git executable.

This often "just works", so this page is aimed at people who have reason to suspect they have a problem.
This usually "just works", so this page is aimed at people who have reason to suspect they have a problem.

This is something you set up once-per-computer.

Expand All @@ -26,26 +26,37 @@ A basic test for successful installation of Git is to simply enter `git` in the

If you are not sure where the Git executable lives, try this in a shell:

* `which git` (Mac, Linux)
* `which git` (Mac, Linux, Git Bash shell on Windows)

* `where git` (most versions of Windows)
* `where git` (Windows command prompt, i.e. `cmd.exe`)

## Tell RStudio where to find Git

If Git appears to be installed and findable, launch RStudio. Quit and re-launch RStudio if there's __any doubt in your mind__ about whether you opened RStudio before or after installing Git. Don't make me stop this car and restart RStudio for you in office hours. DO IT.

From RStudio, go to *Tools > Global Options > Git/SVN* and make sure that the box *Git executable* points to ... the Git executable. It should read something like:

* `/usr/bin/git` (Mac, Linux)
From RStudio, go to *Tools > Global Options > Git/SVN* and make sure that the box *Git executable* points to your Git executable.

On macOS and Linux, the path usually looks something like so:

``` bash
/usr/bin/git
```

If you need to set this on macOS, it can sometimes be hard to navigate to the necessary directory, once you've clicked "Browse" and are working with a Finder-type window. The keyboard shortcut "command + shift + g" will summon "Go To Folder", where you will be able to type or paste any path you want.

On Windows, this path should look something like so:

``` bash
C:/Program Files/Git/bin/git.exe
```

* `C:/Program Files (x86)/Git/bin/git.exe` (Windows)
and here is a screenshot on Windows:

Here is a [screenshot](http://www.molecularecologist.com/wp-content/uploads/2013/11/Screenshot-2013-11-12-09.53.56-Copy1.png) of someone doing this on a Windows machine.
![RStudio screenshot showing path to Git executable](img/windows-rstudio-git-executable-screenshot.png)

- __WARNING__: On Windows, do __NOT__ use `C:/Program Files (x86)/Git/cmd/git.exe`. `bin` in the path is GOOD YES! `cmd` in the path is BAD NO!
- __WARNING__: On Windows, do __NOT__ use `git-bash.exe`. Something that ends in `git.exe` is GOOD YES! `git-bash.exe` is BAD NO!
**WARNING**: On Windows, do __NOT__ use `C:/Program Files/Git/cmd/git.exe`. `bin` in the path is GOOD YES! `cmd` in the path is BAD NO!

* At times, we've had trouble navigating to the necessary directory on Mac OS, once we've clicked "Browse" and are working with a Finder-type window. The keyboard shortcut "command + shift + g" will summon "Go To Folder", where you will be able to type or paste any path you want.
**WARNING**: On Windows, do __NOT__ set this to `git-bash.exe`. Something that ends in `git.exe` is GOOD YES! `git-bash.exe` is BAD NO!

**Restart RStudio if you make any changes.** Don't make me stop this car again and restart RStudio for you in office hours. DO IT.

Expand All @@ -55,7 +66,7 @@ No joy?

* I've seen this help: With your Project open, go to `Tools > Project Options...`. If available, click on "Git/SVN" and select "Git" in the Version control system dropdown menu. Answer "yes" to the "Confirm New Git Repository" pop up. Answer "yes" to the "Confirm Restart RStudio" pop up.

* If you installed Git via GitHub for Windows, it is possible the Git executable is really well hidden. Get our help or install Git another way.
* If you installed Git via GitHub for Windows, it is possible the Git executable is really well hidden. Get help or use one of [our recommended methods of installing Git](#install-git).

* Your `PATH` is probably not set up correctly and/or you should re-install Git and control/notice where it's going. Read more in \@ref(troubleshooting).

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 074734a

Please sign in to comment.