RStudio Git Support

Written by: Paul Rubin

Primary Source: OR in an OB World

 One of the assignments in the R Programming MOOC (offered by Johns Hopkins University on Coursera) requires the student to set up and utilize a (free) Git version control repository on GitHub. I use Git (on other sites) for other things, so I thought this would be no big deal. I created an account on GitHub, created a repository for my assignment, cloned it to my PC, and set about coding things. As a development IDE, I’m using the excellent (and free) RStudio, which I was happy to discover has built-in support for Git. All went well until I committed some changes and tried to push them up to the GitHub repo, at which point RStudio balked with the following error message(s):

error: unable to read askpass response from ‘rpostback-askpass’
fatal: could not read Username for ‘’: No such device or address

I searched high and low in RStudio but could not find any place to enter credentials for the remote repository. No worries, thought I; I’ll just add my public encryption key on GitHub, and use the private key on the PC, which works for me when I’m using the NetBeans IDE with BitBucket. Alas, no joy.

According to the error messages, the immediate issue seems to be not my password (I don’t think the challenge got that far) but my user name. Git has a global value for my user name recorded on my PC, but it’s not the same as my user name on GitHub. I was able to set a “local” user name, matching the one I have on GitHub, by opening a terminal in my R project directory and entering the command

git config <my GitHub name, in quotes>
git config <my email address>

That’s a bit more arcane than what I would expect a beginner to know, but so be it. I thought that would fix the problem. It did not; the error message remained unchanged. I suspect that the issue is that Git now has two names for me (global and local-to-the-R-project). If I run

git config -l

in the project directory, I see the following:<my global user name><my global email address><my GitHub user name><my GitHub email address, same as the global one>

With two user names to choose from, perhaps RStudio is grabbing the global one? Or perhaps I’m barking up an entirely incorrect tree trying to find the source of the error.

At any rate, I can’t seem to push updates from the PC to GitHub using RStudio. Not to worry, though. There are other options. You can do it from the command line (if you are command-line user of Git, which for the most part I’m not). You can also use a separate Git client program, which is what I did. My Git GUI of choice is SmartGit, from which it is no chore to push (or pull) updates.

question not relevant to this post, consider asking it on OR-Exchange.
The following two tabs change content below.
I'm an apostate mathematician, retired from a business school after 33 years of teaching mostly (but not exclusively) quantitative methods courses. My academic interests lie in operations research. I also study Tae Kwon Do a bit on the side.

Latest posts by Paul Rubin (see all)