11

When attempting to push to GitHub from RStudio, I get the following errors.

error: unable to read askpass response from 'rpostback-askpass'
fatal: could not read Username for 'https://github.com':
       No such device or address

RStudio has my origin as

https://github.com/rmscriven/other.git

when it actually should be

https://github.com/rmscriven/saber.git

RStudio will not allow me to change the origin from the version control system. Here is what it shows:

enter image description here

Is it possible to change my GitHub origin url from RStudio?

Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
  • You'll need to use Git to fix this. Could you perhaps try creating a new project from version control using RStudio instead? Go to "File/New project..." and select "Version Control". If this succeeds, try pushing. – krlmlr Jul 24 '14 at 21:41
  • Should "repository url" be the path to the package? Or my homepage? `fatal: destination path 'saber' already exists and is not an empty directory.` – Rich Scriven Jul 24 '14 at 21:45
  • 2
    Use an empty target directory. Look for "clone URL" on your GitHub project page, perhaps choose the SSH variant. – krlmlr Jul 24 '14 at 21:53
  • 1
    @krlmlr - that worked. Thanks a million. Post as answer if you like – Rich Scriven Jul 24 '14 at 23:46
  • Glad I could help. I won't add an answer, but perhaps you could summarize the main findings. – krlmlr Jul 25 '14 at 00:43

3 Answers3

6

Thanks to the pro tip provided by @krlmlr in the comments,

Use an empty target directory. Look for "clone URL" on your GitHub project page, perhaps choose the SSH variant.

I clicked "clone url" on GitHub once, nothing. Then again, nothing. And once again for good measure, nothing. So I went to the terminal, read the man git help file, and decided to change my password and reconfigure. These are the lines I ran, and it was successful.

git config --global user.name <myuser.name>
git config --global user.email <myuser.email>   
git clone https://github.com/rmscriven/saber.git
git pull

Then I went to RStudio and it allowed me to clone my repository, and change the URL of my version control setting. Here's a colorful pic

New project -> Version Control -> Git -> Create Project

enter image description here

Next, magic happened, and I had a copy of my package which I very carefully removed to prepare to push the development tarball to GitHub. Rock on.

@krlmlr, I thank you for nudging me in the right direction. Now I feel like I'm actually doing it the right way. :)

And for fun, try saying 'rpostback-askpass' ten times fast.

Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
4

I had the same problem and for me these two simple steps worked great:

  1. Add the SSH key from RStudio to my github account.

  2. Change the origin URL and use the -u flag for push/pull once (solution found here).

For 1., in RStudio go to Tools → Global Options... → Git/SVN → view public key, and copy the key. In your browser of choice, logged in on Github, click Edit Profile → SSH keys and paste the copied key here.

For 2., back in RStudio, click Tools → Shell… , then enter:

git remote add origin https://github.com/myname/test.git
git config remote.origin.url git@github.com:myname/test.git
git pull -u origin master
git push -u origin master

Of course, change "myname" to your username and "test.git" to the name of your project. (Or even "github.com" to the URL of your institute's github or similar.)

After doing this once, the Push/Pull buttons in RStudio should work and you don't need the shell anymore!

Edgar
  • 412
  • 2
  • 6
  • 15
  • 1
    This got me through the briar patch. First I had to git remote remove origin. The "-u" switch in pull is unrecognized (though in the help file it means "--update-head-ok"). The "-u" switch in push is recognized; it means "--set-upstream". So that's good. It seems I have to do all these steps individually for each project. But in the meantime, thank you Edgar! – Roger Apr 02 '18 at 16:30
0

I've been running into this issue on multiple computers now, with a remote that doesn't support SSH and thus can't leverage password-less login.

The problem in this case is that by default, git ask for the password interactively, and RStudio can't display this graphically. The trick is to use git's credential storage system.

For instance on Mac OS X:

git config --global credential.helper osxkeychain

On Linux one could use the gnome-keyring integration.

Community
  • 1
  • 1
Calimo
  • 7,510
  • 4
  • 39
  • 61