gpt4 book ai didi

ssh - Gitlab:无法在家中进行 SSH(Windows)

转载 作者:行者123 更新时间:2023-12-02 14:02:58 26 4
gpt4 key购买 nike

我无法通过家用 PC 让 SSH 为 GitLab 工作。

要清楚:
1. SSH 在同一台机器上对 BitBucket 工作正常
2. SSH key 已添加且正确
3. 我通过 VPN 连接(工作中)

当我尝试使用 -v -v -v 参数连接时,我得到以下输出:

$ ssh git@[server] -v -v -v
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me]/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [ip] port 22.
debug1: connect to address [server] port 22: Attempt to connect timed ` out wssh: connect to host [server] port 22: Bad file number

这可能是服务器配置问题吗?

编辑:

我生成了一个新 key 并配置了 ssh 来使用它。
这是输出:
$ ssh -Tvv git@[server]
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me].ssh/config
debug1: /c/Users/[me]/.ssh/config line 5: Applying options for [server]
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [IP] port 22.
debug1: connect to address [IP] port 22: Attempt to connect timed out without establishing a connection
ssh: connect to host [server] port 22: Bad file number

最佳答案

SSH works fine for BitBucket on the same machine SSH key has been added and is correct



我希望它不是添加到 GitLab 的同一个 ssh key ,而是一个不同的公共(public) key (对于相应的不同私有(private) ssh key )

在这种情况下,您需要一个 ~/.sssh/config 来引用两个公钥,如“ How to set up two SSH keys for two GitLab accounts and push/pull by using TortoiseGit? ”:
# my primary account for BitBucket
Host bitbucket
User git
HostName bitbucket.com
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa1

# for GitLab server
Host gserver
User git
HostName {server}
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa2

同时,检查以下输出:
ssh -Tvv gserver

(“ gserver”是 .ssh/config 文件的条目,它引用正确的私有(private) ssh key ,用户“ git”)

关于ssh - Gitlab:无法在家中进行 SSH(Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30958010/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com