Comments (36)
This also happened to me today. Newly updated RStudio and fresh install of git from git-scm.com after a macOS Sierra update.
I was also stumped by the RStudio git binary picker which looked correct at /usr/bin/git
, but my actual git installation was at /usr/local/bin/git
(as found with the which git
command). Once I pointed RStudio to the correct git binary location, everything reappeared.
Hopefully this will be useful to others as well, this issue is in the top google results for "RStudio wont detect git"
from happy-git-with-r.
My fix to this problem was to change the Git executable path in RStudio > Preferences > Git/Svn from /usr/bin/git to /usr/local/bin/git and then restart RStudio.
from happy-git-with-r.
Same problem. Solved it twice using two different methods:
- By using
/usr/local/git/bin/git
. For some reason/usr/local/bin/git
(mentioned by @joebowness ) is just a shortcut to/usr/local/git/bin/git
, andusr/bin/git
, despite pointing to what appears to be a git executable, doesn't work at all (without xcode, see 2). - By installing xcode and confirming with username and password. In this case
usr/bin/git
is the the exec being used by rstudio.
Is it odd that there are multiple git execs in subdirectories of the same directory? One of them, /usr/local/git/bin/git
, the one that works without xcode, was created precisely one year ago and is thus older than the other, usr/bin/git
, which was created in July and only works with xcode.
from happy-git-with-r.
You're right. I just uninstalled Xcode (which is actually almost 11 GB). The git pane in Rstudio disappeared. Then I installed the command line tools using xcode-select --install
, restarted R and… voilá! Everything seems to be working now. Thanks!
from happy-git-with-r.
I had this same problem even after installing XCode and the command line tools. It was fixed after I ran a simple command in the terminal like git config --global --list
which then forced me to agree to the XCode license agreement. Then, restarted RStudio and it recognized that git was on my system.
from happy-git-with-r.
@cmartin, if you just updated to macOS Sierra, then likely one of the side effects of that was that the command line tools were uninstalled. What happens if you try to run
/usr/bin/git --version
/usr/bin/clang --version
from the terminal? If I'm correct, you should get a dialog asking you to reinstall command line tools -- please let us know if that was the case!
from happy-git-with-r.
Troubleshooting tips from @kevinushey:
Check Sys.which("git")
in addition to which git
. Record what both return.
Inspect .gitconfig. Is there anything strange / surprising? E.g. in the project where git isn't working:
git config --global --list
git config --system --list
git config --local --list
Note that, if current project is NOT already a git repo, git config --local won't work for obvious reasons.
Are there any git-related errors in the logs? (Help -> Diagnostics ->
Show Log Files; there should be a file 'rsession-.log'; if
there was something emitted it should show up near the end of that
logfile)
Is it possible that the associated git config files have permissions
that disallow RStudio from reading them?
from happy-git-with-r.
We could navigate to this screen but the only entry in the Version control system dropdown was "(None)".
We simply had no access to Git functionality at all. For example, when creating a new repo de novo, there was no check box to make it a Git repo.
from happy-git-with-r.
All I did was xcode-select --install
and then re-opened my Rstudio Projects and they were all fixed (i.e. git pane was appearing again).
UPDATE Dec 6, 2018: Issue came up for me again after installing macOS Mojave (10.14.1). This time I did 2 things to resolve it.
xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools
For more information see Stack Overflow question here
from happy-git-with-r.
I had this same problem and managed to fix with the following steps (using MacOS Sierra, 10.12.6):
- check global git repo ( git config --global --list )
- navigate to project repo using Terminal
- at this point I edited one of the files and pushed to the project repo, to test whether git was working w/o RStudio, but I don't think this was a necessary step
- run
git init
- close and reopen the project in RStudio
- Git tab reappears
from happy-git-with-r.
I recommend installing just the Xcode command line tools:
http://happygitwithr.com/install-git.html#mac-os
Based on your 6 GB comment, I wonder if we're miscommunicating and you installed Xcode in its entirety ... although I admit I don't know the size of Xcode command line tools. In that same section are ways to install Git that are more surgical, but not as easy.
from happy-git-with-r.
It looks like RStudio does provide some UI for initializing a Git repository in a project -- within Tools -> Project Options
, there should be an option for enabling Git, e.g.
Was this dialog available in each case?
from happy-git-with-r.
There have been a couple Xcode updates released recently, so I expect users will be bumping into this again. We're planning to report this state more clearly in the IDE:
but that won't become part of an official RStudio release for a little while yet.
Until then, executing:
sudo xcode-select --install
/usr/bin/git --version
in a terminal should be sufficient to see whether Apple wants you to agree to the Xcode license or install command line tools.
from happy-git-with-r.
More from @kevinushey:
Try moving the /usr/local/bin/git (a symlink) out of the way. Doe that help? Does OS X
fall back to a default version of git?
not sure if that was tried or how it panned out @ttimbers?
from happy-git-with-r.
I should also double check -- has the git repository actually been initialized for that directory (has git init
been called)? Does the .git
directory exist in those projects?
I think that, if a git
executable is detected / set, then the option to create new R projects with git
initialized is provided, e.g.
If the Create a git repository
is not checked, then git init
is not run as part of the project creation process, and then RStudio won't detect that the project is managed by git and hence won't show the Git pane.
FWIW, I did try using the version of git provided at https://git-scm.com/downloads and all seemed well.
from happy-git-with-r.
Looking a bit into the details of the source code, when deciding whether to show Git-related GUI, it checks:
- Is VCS enabled? (this should be set in the Git/SVN tab of Global Options; given that the path to the Git executable is being set I believe this should be the case),
- Can we successfully run
git --version
? That's used as the canary as to whether git can actually be used for that project.
We also have some special handling for Mavericks -- from comments in the source code, it sounds like Apple installed a 'dummy' version of git
into /usr/bin/git
, and one needs to install OS X developer tools to get the 'real' version of git.
I wonder if Mike and Natalia are able to run /usr/bin/git --version
successfully? Maybe RStudio is inadvertently trying to use the version of git
at /usr/bin/git
, but that is failing for some reason (e.g. missing developer tools, borked system git
installation for other reasons)?
Note that these checks are done on RStudio startup, before the R process is initialized, and so they would likely see the default binary path /usr/bin
before e.g. /usr/local/bin
.
from happy-git-with-r.
@jennybc @kevinushey we did not get the chance to try to move the /usr/local/bin/git (a symlink) out of the way, but we did try adding the "true" git to the $PATH and then pointing RStudio there. That did not help.
from happy-git-with-r.
@kevinushey yes, VCS was enabled on both of these machines via the Git/SVN tab of Global Options, and we also set the path to the Git executable in that tab.
Although we did not test git --version
, git did work from the command line and a git client (Git Kraken) on both machines.
I will see Mike on Tuesday and see what happens when we try /usr/bin/git --version
. But maybe what we need to recommend is that they install OS X developer tools to get the 'real' version of git.
from happy-git-with-r.
VCS was enabled on both of these machines via the Git/SVN tab of Global Options, and we also set the path to the Git executable in that tab
Just to elaborate: we were able to set the path enough for RStudio to accept it and for it to persist when we left the dialogue box and came back. So RStudio acknowledged this git executable in some narrow sense. But the IDE never changes, i.e. no Git pane ever appears. And we get an actual error whenever we do anything that would cause RStudio to call Git. It's like we get past whatever logic governs this interface. But then this path is being overridden or ignored at the moment of truth.
git did work from the command line and a git client (Git Kraken) on both machines.
Git Kraken calls libgit2, as GitUp does. So Git Kraken will work even in the complete absence of a functional local git installation. So the success from the command line is the real proof that we should be able to make RStudio do git things.
recommend is that they install OS X developer tools
Yeah I am definitely re-writing the instructions today.
from happy-git-with-r.
Thanks @nickreich! Helpful to have such reports.
from happy-git-with-r.
Isn't there also a need and some way to trigger re-accepting the Xcode CLT EULA or whatever? After an OS upgrade?
UPDATE: right, I see this is already mentioned much earlier in this thread.
from happy-git-with-r.
I was following this guide: http://r-pkgs.had.co.nz/git.html#git-init. I got stuck on the part after
In a shell, run git init. Restart RStudio and reopen your package.
I couldn't see the git pane right away. I had to go to View->Show Git
from happy-git-with-r.
@GershTri It's hard to say exactly how you got into this state. How did you install git one year ago? The simplest way I know to get Git working on Mac OS and with RStudio is definitely via Xcode command line tools. Which seems to be where you've ended up. And, yes, there have been combinations of Mac OS and RStudio versions where only the Xcode-managed version of Git would actually work (although I believe that is not the current situation).
from happy-git-with-r.
I wasn't aware that git was already installed on macs, so I installed it myself. Usually apps recognize other versions of themselves during installation, which is why I'm a little perplexed by my labyrinthine usr/ directory. Installing Xcode is definitely the easiest method to get things working, but you end up with an app that you will probably never use parked on nearly 6 GB of valuable hard drive real estate. It seems like there should be a better way.
from happy-git-with-r.
Thank you so much, these instructions helped me reinstall Git for RStudio!!!
from happy-git-with-r.
+1, worked for me
from happy-git-with-r.
thank you all!
from happy-git-with-r.
For those of you helped by this thread ... is there one or two tips that constitute the "bottom line" and that should be incorporated into the instructions?
I'm having a hard time determining if there is an action item for me and would appreciate such a summary.
from happy-git-with-r.
I updated R, RStudio, and OS to HighSierra.
xcode-select --install . I launched it in the App Store, re-installed xcode (I think as a result of HighSierra). Then I agreed to terms in shell. Next, I restarted R, created a project, and was able to enter git info.
from happy-git-with-r.
I had this same problem even after installing XCode and the command line tools. It was fixed after I ran a simple command in the terminal like
git config --global --list
which then forced me to agree to the XCode license agreement. Then, restarted RStudio and it recognized that git was on my system.
@nickreich : AMazing Reply, that did help
from happy-git-with-r.
I had this same problem even after installing XCode and the command line tools. It was fixed after I ran a simple command in the terminal like
git config --global --list
which then forced me to agree to the XCode license agreement. Then, restarted RStudio and it recognized that git was on my system.@nickreich : AMazing Reply, that did help
This worked for me too after RStudio suddenly stopped showing git tools. XCode is often updated in the background and breaks things like this silently.
from happy-git-with-r.
Same problem for me in 2020: Had to browse into /usr/bin/git and step back to /usr/local/bin/git for the git. The svm path was correct.
From CMartin in 2016: I was also stumped by the RStudio git binary picker which looked correct at /usr/bin/git, but my actual git installation was at /usr/local/bin/git (as found with the which git command). Once I pointed RStudio to the correct git binary location, everything reappeared.
from happy-git-with-r.
Same problem for me in 2020: Had to browse into /usr/bin/git and step back to /usr/local/bin/git for the git. The svm path was correct.
From CMartin in 2016: I was also stumped by the RStudio git binary picker which looked correct at /usr/bin/git, but my actual git installation was at /usr/local/bin/git (as found with the which git command). Once I pointed RStudio to the correct git binary location, everything reappeared.
Just had the same issue, git disappeared from Rstudio out of nowhere shortly after I successfully cloned a repo using Rstudio. Changing the path to the git installation from "usr/bin/git" to "usr/local/bin/git" as you described fixed it for me as well.
from happy-git-with-r.
xcode-select --install
worked perfectly. I think maybe the macOS update triggered it.
from happy-git-with-r.
You're right. I just uninstalled Xcode (which is actually almost 11 GB). The git pane in Rstudio disappeared. Then I installed the command line tools using
xcode-select --install
, restarted R and… voilá! Everything seems to be working now. Thanks!
This looks to be a very long drawn solution. Is this the final and only solution? I am stuck with the same problem that rstudio does not detect git while if I go to a mac terminal or rstudio terminal pane we can execute git commands.
from happy-git-with-r.
@sanjmeh In one of the places where git works, do which git
to reveal where the executable lives. Then tell RStudio about that path in Tools > Global options > Git/SVN. At least, that's a sketch of a solution.
from happy-git-with-r.
Related Issues (20)
- render formula in .R script
- Possible redirects I should set up
- Local or remote branch?
- More help with weird git installs HOT 2
- No 2FA mention anymore?
- How to copy and paste in the terminal inside RStudio
- GitHub Icons/Tables do not appear after installation in Rstudio
- HTTPS doesn't work anymore HOT 1
- Can't push commits anymore (tries forever and does not through any error) after update of macOS, xcode, R, Rstudio HOT 1
- Specify that GitHub PAT instructions are for classic tokens
- No 'ssh' command found. Using default ssh settings. HOT 2
- Issues opening terminal in RStudio
- bus error HOT 2
- Link broken in '7.1.1 Configure the Git editor' HOT 2
- git remote clone HOT 1
- Error in if (file.exists(pythonPath)) return(pythonPath) : the condition has length > 1 HOT 1
- PAT storage on Linux HOT 1
- RStudio now defaults to `ed25519` algorithm for ssh keys
- git commit fails in RStudio GUI
- Fork as template situations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from happy-git-with-r.