几个星期以来,我不能从远程存储库中拉或推到远程存储库中。我以为这是在升级到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可执行文件。

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


当前回答

我通过在命令中的SSH -agent中添加我的SSH私钥来解决这个问题:

$ ssh-add -K ~/.ssh/id_rsa

设置设置——>版本控制——> Git,然后,在SSH可执行下拉菜单中,选择本机

其他回答

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


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

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

加上这个答案,因为没有一个答案对我有用。

我有证书颁发-所以下面的命令做到了戏法。

Git配置——global http。sslVerify假

从 https://confluence.atlassian.com/fishkb/unable-to-clone-git-repository-due-to-self-signed-certificate-376838977.html

我用在线课程的叉子时遇到了这个问题。我克隆了我的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

如果你想连接到像github或bitbucket这样的云服务,请检查Idea代理设置。这可以通过寻找要安装的插件或在帮助菜单中检查软件更新来完成。 如果internet/代理设置不正确,请添加有效条目或将其设置为自动

您需要生成一个新的SSH密钥并将其添加到您的SSH -agent。你应该点击这个链接。

在您创建公钥并将其添加到您的github帐户后,您应该在Intellij Idea中的设置->版本控制-> Git -> SSH可执行文件下使用内置(不是本机)选项。