【发布时间】:2014-10-29 14:17:15
【问题描述】:
我刚刚获得了 PhpStorm 的许可证,我尝试设置密钥对以将代码提取到 Gitlab,但我不知道在哪里以及如何进行此操作?我在哪里做这个?这个问题似乎与 PhpStorm 没有使用 root 权限有关。
【问题讨论】:
标签: git phpstorm gitlab openssh
我刚刚获得了 PhpStorm 的许可证,我尝试设置密钥对以将代码提取到 Gitlab,但我不知道在哪里以及如何进行此操作?我在哪里做这个?这个问题似乎与 PhpStorm 没有使用 root 权限有关。
【问题讨论】:
标签: git phpstorm gitlab openssh
虽然我不完全确定这是给出这个答案的最合适的地方,但我相信这是其他人在尝试通过 VCS for PHPStorm 连接到 GitLab 时遇到的问题最有可能出现的地方(或者,真的,任何 JetBrains IDE)。
话虽如此,我遇到的问题与 OP 非常相似——在运行 Git Bash 时,我通过 SSH 连接到 Git Lab 完全没有问题。但是,当尝试通过 Git 与 PHPStorm 的 VCS 连接时,它会永远挂起。
首先,我自己的发现对你们这些在 Windows 上运行 JetBrain IDE 的人来说是隐秘的。
如果像 OP 和我一样,您之前已经能够通过 Git Bash 进行连接,那么此时您应该能够连接并使用 VCS 来满足您的 Git 需求。
【讨论】:
您必须在外壳上创建一对密钥。因此请遵循这些instructions。然后将公钥的内容复制到您的 GitLab 用户帐户。
【讨论】:
.pub)添加到您的 GitLab 用户帐户。因此,转到您的个人资料,切换到 SSH keys 并添加一个新的 SSH 密钥。将公钥的内容复制到此表单中。
我从未使用过 Netbeans,因此不确定是否将私钥直接添加到 IDE 中,但 PHPStorm 使用标准 Git/SSH 设置。
PHPStorm 将使用标准 $HOME/.ssh 或 %userprofile%/.ssh - 您可以在此处存储单个 id_rsa 密钥,或者如果您使用多个密钥,则可以将配置添加到 %userprofile%/.ssh/config。
PHPStorm 帮助文件中有一些信息 - http://www.jetbrains.com/phpstorm/webhelp/using-git-integration.html#d598046e253
如果您在 Windows 上使用 plink,请确保先连接 PuTTY 或 plink,以便您可以接受服务器的主机密钥..
plink git@gitlab.com:group/repo.git
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 b6:03:0e:39:97:9e:d0:e7:24:ce:a3:77:3e:01:42:09
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
Welcome to GitLab, User!
根据您的设置,使用 ssh-agent 或 Pageant 并添加您的密钥(ssh-add,如果使用 ssh-agent),这样就不会每次都提示您输入密码。
您的另一种选择是通过 https 连接并提供您的凭据。
【讨论】: