Rstudio greyed out Git commands and (No branch)

I had a similar problem with a repo I had already configured locally and pushed and pulled from/to it using CLI (although I didn't have the problem of being detached from a branch) and I solved it by doing the following:

  1. Open your console and navigate to your repo
  2. Make some commit
  3. Make a push using -u (i.e. --set-upstream) flag, eg: git push origin master -u
  4. Open Rstudio (or restart it if it was open while performing the previous step) and you'll see the push and pull icons are no longer greyed out.

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.


As commented:

Tt turns out to be an RSA key issue.
The wrong key was in the Rstudio Config, which explains how Shell would work but not the Rstudio interface.

Tags:

Git

R

Rstudio