无法从windows/phpstorm推送到git

无法从windows/phpstorm推送到git,git,Git,我的存储库在Bitbucket上。我有一台Ubuntu机器,用作开发服务器(它托管我所有代码、apache、php、git等的本地副本)。实际开发是在同一局域网中的Windows计算机上完成的。我使用Samba共享直接访问服务器上的文件。 我使用PHPStorm作为我的IDE。我也在Windows机器上安装了git,以便在PHPStorm中使用git集成。它可以工作:我可以读取存储库历史记录并提交新的更改,而不会出现任何问题 但现在我也想从PHPStorm中推(到bitbucket)。这就是失败

我的存储库在Bitbucket上。我有一台Ubuntu机器,用作开发服务器(它托管我所有代码、apache、php、git等的本地副本)。实际开发是在同一局域网中的Windows计算机上完成的。我使用Samba共享直接访问服务器上的文件。 我使用PHPStorm作为我的IDE。我也在Windows机器上安装了git,以便在PHPStorm中使用git集成。它可以工作:我可以读取存储库历史记录并提交新的更改,而不会出现任何问题

但现在我也想从PHPStorm中推(到bitbucket)。这就是失败的原因

现在,我需要登录到我的Ubuntu服务器,从那里推送代码。但我希望能够从PHPStorm中进行psuh。这可能与我需要集成的ssh密钥有关,但我不知道如何集成。PHPStorm告诉我以下几点:

19:22:10.873: git push --progress origin master:master
java.io.IOException: Authentication failed: 
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:283)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:157)
    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.
我已经创建了一个SSH密钥对,并将公钥放在Bitbucket上。我只是不知道该怎么办。

手册页确实提到:

  • ssh密钥在PhpStorm外部生成。您可以按照或查找其他指南中的说明进行操作
  • 将ssh密钥存储在主目录
    \.ssh\
    文件夹中。主目录的位置通过环境变量定义:
    • $HOME
      适用于类Unix操作系统
    • Microsoft Windows操作系统的
      %userprofile%
  • 确保密钥存储在具有正确名称的文件中:
    • id\u rsa
      用于私钥
    • 公钥的id\u rsa.pub

如果您在PhpStorm中使用本机SSH可执行文件选项&链接到PuTTY提供的
plink.exe
,则需要至少连接到主机服务器一次才能接受服务器的主机密钥。缓存密钥后,您可以将私钥添加到
pageant.exe

plink.exe git@github.com
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) y
Using username "git".
Server refused to allocate pty
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

如果您的git命令是从命令行工作的,但不是从WebStorm内部工作的,那么您可以尝试切换WebStorm配置以使用“本机”而不是“内置的”SSH可执行文件


为此,请浏览文件->设置->版本控制->Git的菜单,然后将SSH可执行文件下拉设置更改为“本机

我遇到了这个问题。我的ssh密钥在Git Bash(Windows)中使用时非常好

我从C:\Users\Your User Name\.ssh文件夹中删除了已知的\u主机,PHPStorm自己创建了它并开始工作

在我的另一个项目中,它给出了以下错误:

java.io.IOException: There was a problem while connecting to 158.xxx.xxx.xxx::22
    at com.trilead.ssh2.Connection.connect(Connection.java:791)
    at com.trilead.ssh2.Connection.connect(Connection.java:577)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:171)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137)
Caused by: java.net.UnknownHostException: 158.xxx.xxx.xxx:: invalid IPv6 address
    at java.net.InetAddress.getAllByName(InetAddress.java:1169)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)
    at java.net.InetAddress.getByName(InetAddress.java:1076)
    at com.trilead.ssh2.transport.TransportManager.createInetAddress(TransportManager.java:165)
    at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:340)
    at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:449)
    at com.trilead.ssh2.Connection.connect(Connection.java:731)
    ... 3 more
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
结果我的GIT项目的远程url设置错误:

ssh://myuser@myip:/home/user/myrepo
应该是:

myuser@myip:/home/user/myrepo

PHPStorm是否可以访问私钥,您是否指示它使用私钥进行身份验证?谢谢,这是一个很棒的教程:)我显然遵循了一个错误的教程。如果您使用多个密钥,您可以将其与
%userprofile%/.ssh/config
配对,以指定要为哪个服务器使用哪个密钥。请提醒那些更改桌面文件夹路径的人:PHPStorm将在/.sshWeird中查找ssh密钥。。。Git命令从命令行工作,而不是在phpStorm内部。但我不得不从“内置”切换到“本地”!!现在它工作了。。。总之,你帮助了我x)这是我成功的关键!但是,我用的是内置的,它仍然在本地的垃圾。我已经确定JetBrains使用putty或其某些版本作为其内置版本。问题:
如果您在PhpStorm中使用本机SSH可执行选项并链接到plink.exe
如何告诉JetBrains使用plink.exe作为本机SSH客户端?您在哪里更改的?您可以使用以下命令更改它:git remote set url起源user@ip:/your_repo