Xander Xander - 1 month ago 11
Git Question

Rstudio greyed out Git commands and (No branch)

I am currently struggling with getting Rstudio to work with my git repositories. When I set up a new project and assign the git repository, the branch is set on Master and the commit, pull, and push buttons are all active. Everything works just fine. Then, at some point the branch is switched to (No Branch) and the commit, pull, and push buttons are greyed out (shown below). This happens to every single git project I make. Works at first then is greyed out.

enter image description here

I am still able to use git commands from Shell, but the GUI interface is not working.

I have spent some time looking through customer support forums and Googling the problem. One site that I found (https://www.r-bloggers.com/things-i-forget-pushpull-greyed-out-in-rstudio/) indicated that there is an issue with the configuration list. However, when I do

git config --list
, I find that I do
have branch.master.remote=origin
and
branch.master.merge=refs/heads/master
at the bottom of the configuration.

I also attempted a
git push -u origin master
, but that did not work either.

I use RStudio and github daily, and I would be so pleased if the GUI interface was working properly again.

I would be very grateful if someone could help me problem solve this issue.

EDIT: I am using OSX 10.9 Mavericks and Rstudio Version 0.99.903.

Answer

Then, at some point the branch is switched to (No Branch) and the commit, pull, and push buttons are greyed out (shown below).

That is typical of a detached HEAD branch: see "Why did my Git repo enter a detached HEAD state?".

Revert to the command-line and check your git status.

You can easily recover from this by a checkout of a branch.
Or by forcing a branch to your current detached commit

git branch -f branch-name HEAD
git checkout branch-name

Then switch back to RStudio: all options should be available again.