简体   繁体   English

无法通过 RStudio 中的 SSH 拉/推 git?

[英]Unable to pull / push through git with SSH in RStudio?

I'm not sure what the issue is, since I'd done this without a problem a long time ago.我不确定问题是什么,因为我很久以前就这样做了。

Basically whenever I try to pull / push through the terminal or RStudio, I'm asked for my username and password (didn't use to be the case).基本上每当我尝试通过终端或 RStudio 拉/推时,都会要求我输入用户名和密码(以前不是这样)。 When I supply them, I get an error message saying that this was disabled.当我提供它们时,我收到一条错误消息,指出它已被禁用。 It used to be that once my SSH public key was added to Github, things just worked.曾经,一旦我的 SSH 公钥被添加到 Github,一切就正常了。

I also tried ssh -T git@github.com it worked fine (I got the "Hi [username]. You've successfully authenticated [...]".我也试过ssh -T git@github.com它工作得很好(我得到了“嗨[用户名]。你已经成功验证了[...]”。

I've introduced myself to git, created new keys, registered them with the ssh agent--no luck.我向自己介绍了 git,创建了新密钥,并使用 ssh 代理注册了它们——不走运。

From the terminal, check the URL used:从终端检查使用的 URL:

cd /path/to/local/repository
git remote -v

If it is an HTTPS one, and you want to use SSH:如果是 HTTPS 一个,并且你想使用 SSH:

cd /path/to/local/repository
git remote set-url origin git@github.com:MyAccount/MyRepository

Once that works from command-line, you can switch back to RStudio.一旦从命令行运行,您就可以切换回 RStudio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM