When you install Git, try to control or record where it is being installed! Make a mental or physical note of these things.
You may be able to find Git after the fact with these commands in the shell:
which git (Mac, Linux)
where git (Windows)
It is not entirely crazy to just re-install Git, using a method that leaves it in a more conventional location, and to pay very close attention to where it’s being installed. Live and learn.
I’m pretty sure that most cases of RStudio not automatically detecting the Git executable stem from problems with PATH. This is the set of directories where your computer will look for executables, such as Git (today) or make (later in this course). Certain methods of Git installation, especially on Windows and/or older OSes, have a higher tendency to put Git in an unconventional location or to fail to add the relevant directory to PATH.
How to see your PATH?
In the shell:
echo $PATH
Take a good hard look at this. See the point above about finding your Git executable or re-installing it while you are wide awake. Is the host directory in your PATH? No? Fix that.
Go here for instructions on what to put in your .bash_profile in order to add a directory to PATH.
See the above section on “Push/Pull buttons greyed out in RStudio.”
Do you get this error in RStudio?
error: unable to read askpass response from 'rpostback-askpass'
Open the shell: Tools > Shell.
git push -u origin master
You might have changes on the remote AND on your local repo. Just because you don’t remember making any edits in the browser doesn’t mean you didn’t. Humor me.
Pull first. Resolve any conflicts. Then try your push again.
Do you have spaces in your directory or file names? I told you that was a terrible idea. Get rid of them.
Is your Git repo / RStudio Project inside a folder that … eventually rolls up to Google Drive or DropBox or a network drive? If yes, I recommend you move the repo / Project into a plain old directory that lives directly on your computer and that is not managed by, e.g., Google Drive.
If you cannot deal with the two root causes identified above, then it is possible that a more powerful Git(Hub) client will be able to cope with these situations. But I make no promises. You should also try Git operations from the command line.
Do not create a Git repository inside another Git repository. Just don’t.
If you have a genuine need for this, which is really rare, the proper way to do is is via submodules.
In STAT 545, you do not need to do this and when we’ve seen it, it’s been a mistake. This has resulted in the unexpected and complete loss of the inner Git repository. To be sure, there was more going on here, but non-standard usage of Git repos makes it much easier to make costly mistakes.
Go back to the index for the all the Git stuff.