New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: "bash: git: command not found" error thrown in RStudio shell, but not in Git Bash #67
Comments
|
Would you like to make a PR for this? This is the kind of practical detail I definitely want to capture here and Windows is not my OS. cc @daattali @kevinushey (does this all sound right to you?) |
|
Definitely really useful to have there. I usually love helping you but I'm out of commission on non essential items for the next few weeks, sorry!
( ^ sorry to be a party pooper) |
|
@everetr: Can you confirm that you are indeed running with RStudio v1.1.383? Normally, the git shell itself places extra utilities on the PATH. Do you by any chance have a startup profile / script that modifies the PATH? For posterity, I see: In addition, this:
We actually removed that option from v1.1.383, as users found it confusing that the type of shell launched differed between Git projects and non-Git projects. Now, we always launch a shell matching the one selected in the I'd also be curious to see what the output of Note the entry called |
|
My mistake. “Use Git Bash as shell for Git projects” is in section 8.1 of the book. I did NOT confirm that that box was checked, because it's not in my RStudio. I'll try to recreate this error and send you screenshots and the output of |
|
I was updating my version of RStudio and Git today and had the exact same issue described by @everetr. His resolution (re-installed with "Use Git from the Windows Command Prompt") worked for me as well. Thanks for posting. |
|
Ha! I set up a Windows VM last night and made sure to select this myself. It was selected by default for me ... at least I think so. But it sounds like we need to repeat or move this advice, yes? |
|
Just re-download Git (did not uninstall) and reproduced the error described in OP. Installation settings:Output of
|
|
Thanks for following up! I'll have to re-test this -- I am pretty sure in my case that the default behavior in the installer was to select "Use Git from the Command Prompt", but it seems as though that's not true in general. Even so, we should make sure that Git integration works even if that option is not selected. |
|
I will make a PR to note this in section 8.1 of the book. |
|
Thanks @everetr!. Should it go in http://happygitwithr.com/install-git.html#windows? Because seems like a fact that is good to know at Git install time. |
|
@jennybc You're right. Thanks! Will do. |
|
Closed via 6f8ec67 |
|
Hi, I just installed git using the exact same settings as OP and I get the same issue: I tried OPs suggestion and reinstalled (checking use git from windows command prompt option) but it still does not work. I'm not able to get Git CMD Working either (Although maybe I dont understand the difference between GitCMD and Git Bash): |
The screenshot is outdated. As of RStudio v1.1.383, there is no option to "Use Git Bash as shell for Git projects". There was an issue with opening Git Bash as the default terminal for RStudio on a Windows machine (as opposed to Command Prompt). This forum cleared up the issue: jennybc#67.
|
Thank you all for this issue post. I just ran into this issue on a new Windows computer (had to get my old one repaired), so I'm setting everything back up. I'm glad to get the terminal working so I can teach my students this new awesome feature of RStudio this semester! |
|
Thanks very much to those who put together this excellent resource. I'm afraid that I, unfortunately, am having issues with Git within RStudio, and was wondering if anyone had a bright idea for the solution? Initially, it was working with my repos, and then one day they started to show the error "RStudio, directory name is invalid". I am using W10, RStudio 1.1.463, git version 2.19.1.windows.1 I have tried the solutions to previous similar questions (repo paths do not contain non-ASCII char). I can use git with SourceTree, so I don't think it's an issue with my git version. When I try to commit/pull/push changes it just shows "RStudio, directory name is invalid" and does not allow me to perform any git commands. Also, when I look at the git viewer in RStudio, it is just blank/white, whereas it would usually allow me to stage files etc. In an attempt to try and fix the issue, I uninstalled and reinstalled git, following the steps above. Whilst git works perfectly well with SourceTree and in the command line, RStudio is not able to find it i.e. in creating a VCS project it returns "Git was not detected on the system path". However, I have placed C:\Program Files\Git\bin\ in the system path via environment variables. I have also set the git executable path in RStudio's global options as C:/Program Files/Git/bin/git.exe. Any help would be appreciated, as whilst it's not essential, it would be nice to get working again |
|
@arnold-c are you attempting to use git with a project that's located on a network drive by any chance? (What is the output of |
|
@kevinushey No, it's on my laptop's C: Drive ( |
|
Interesting. Would you mind filing this as a bug report at https://github.com/rstudio/rstudio/issues? A diagnostics report may be helpful as well. |
|
@kevinushey Sidenote: Are there known issues with using Git+RStudio on a network drive? Is this Windows-specific? |
|
@kevinushey Thanks for your help. I've submitted a bug report and referenced this discussion. |
|
@everetr On Windows specifically, we've seen some issues when using Git from RStudio within a project that lives on a network path referenced with a UNC path (e.g. |
|
I'm stuck on a beginner problem of using git please a little Help is really appreciated I'm stuck on this for many days |




















tl;dr, In the book, can you consider telling Windows users to select "Use Git from the Windows Command Prompt" when installing Git? I believe it prevents the following headache.
I ran into the error described here. My scenario:
which gitin Git Bash returned thegit.exelocation.gitcommands in Git Bash with no errors. Could set username and email.which gitgave a really long error message.git --versionandgit config --global --listthrew the error,bash: git: command not found.which gitin Git Bash.I confirmed that the “Use Git Bash as shell for Git projects” box in Tools > Global Options > Git/SVN was ticked.Edit: This option is not in RStudio v1.1.383. My confusion.MSYS, notcmd.exenorMINGW64, as you warned in the book here.My resolution:
git config --global --listin Git Bash showed my same username and email. No need to reset.which gitin RStudio's shell returned thegit.exelocation.gitcommands work in RStudio's shell now.Perhaps this is worth noting in the book? A good spot would be under section 8.1 here, since related notes for Windows users are already there.
The text was updated successfully, but these errors were encountered: