几个星期以来,我不能从远程存储库中拉或推到远程存储库中。我以为这是在升级到IntelliJ IDEA 14时发生的,但我也可以用IDEA 13.1.5重现这个问题。

工具提示说 “获取失败 致命:无法从远程存储库读取。"

版本控制选项卡中的异常为

14:02:37.737: cd C:\dev\project
14:02:37.737: git -c core.quotepath=false fetch origin --progress --prune
java.io.IOException: Padding in RSA public key!
    at com.trilead.ssh2.signature.RSASHA1Verify.decodeSSHRSAPublicKey(RSASHA1Verify.java:37)
    at com.trilead.ssh2.KnownHosts.addHostkey(KnownHosts.java:98)
    at com.trilead.ssh2.KnownHosts.initialize(KnownHosts.java:414)
    at com.trilead.ssh2.KnownHosts.initialize(KnownHosts.java:440)
    at com.trilead.ssh2.KnownHosts.addHostkeys(KnownHosts.java:137)
    at org.jetbrains.git4idea.ssh.SSHMain.configureKnownHosts(SSHMain.java:462)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:155)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

使用IntelliJ内置终端,执行git -c core。Quotepath =false fetch origin -progress -prune,它就像它应该的那样工作。

根据堆栈跟踪,我的KnownHosts似乎有问题,所以我从~/删除了我们的git服务器。ssh/known_hosts,希望IntelliJ再次插入它。但是当通过UI更新时,问题仍然出现,并且在known_hosts中没有写新的条目;考虑对文件进行缓存,我重新启动了IntelliJ,但没有成功。

当从终端进行另一次git取回时,现在我被问到是否要永久添加服务器。之后,它再次被写入known_hosts,但IntelliJ仍然不让我更新我的项目。

我还没有在网上找到任何关于这种行为的信息,所以我猜这不是新的IntelliJ版本的已知错误。尽管如此,我更新到14.0.2,但问题仍然存在。

IntelliJ被配置为使用内置的SSH可执行文件。

有人知道问题出在哪里吗?


当前回答

更新至2022.2.4版本 从上面这么多的答案,我更新了我的ssh配置,但Intellij仍然不能做git的动作 唯一缺少的步骤是chmod 600 ~/。$USER ~/.ssh/config。在这之后,我重新启动了Intellij,它开始工作了

其他回答

什么都帮不了我。然后我看到计算机上的项目名称与git存储库中的名称不同。

所以我解决了这个问题。

我用在线课程的叉子时遇到了这个问题。我克隆了我的fork,然后遇到了权限错误。我不明白为什么它坚持说我是来自其他公司的用户。但是正如前面的评论者提到的,我已经检查了使用ssh设置的克隆git存储库,我忘记给我的新帐户添加ssh密钥。所以我这样做了,但仍然不能推,因为我得到了这个错误。我解决这个问题的方法是使用Github桌面客户端进行推送。

外卖:

When you open a new GitHub account make sure to add an ssh key to it Use different ssh keys for different accounts In general I run into some GitHub issue on IntelliJ at least once or twice for every project. Make sure you have a copy of GitHub desktop and load your projects into it. It can and will help you with lots of problems you may run into with Intellij - not just this one. It's actually a really nice GUI client and free! It probably makes sense to do what @yabin suggests and use the native client on a Mac

我通过重新添加远程存储库解决了这个问题:VCS -> Git -> Remotes。

我最近(2018年2月)在WebStorm上遇到了这个问题,(当时)以前的解决方案都不适合我。在花了几个小时进行故障排除和研究后,我安装了2018年EAP版本,现在它可以工作了!


IntelliJ Idea > VCS/Git子系统于2017年12月报告的新问题,该问题在181.2445版本(或2018年1月31日之后的任何最新版本)中得到修复。

另请参阅post Update-ssh-key-to-use-new-passphrase

我们最近从IntelliJ 12更新到IntelliJ 14 Ultimate,我们也遇到了这个问题。我们的解决方案是在设置中禁用代理。我们也曾经不记得密码,但可能不确定这是否有帮助。 代理设置在文件设置-外观和行为-系统设置- http代理下。