Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t与gitlab建立ssh连接_Git_Ssh - Fatal编程技术网

Can';t与gitlab建立ssh连接

Can';t与gitlab建立ssh连接,git,ssh,Git,Ssh,我在gitlab上有一个项目,我正试图推动一个承诺。我首先用https url克隆了该项目,但随后将其更改为ssh,然后运行cat~/.ssh/id_rsa.pub,它为我提供了ssh密钥:我已将密钥复制粘贴到gitlab配置文件中的ssh密钥,但在尝试推送提交时,我收到一条消息: 无法建立主机“gitlab”的真实性。RSA密钥 指纹是SHA256:cZiqgz2tMzLXftNIIXmQ9v+6M38xM1LzxROnDM1OJ0Q。 是否确实要继续连接(是/否)?对 警告:已将'07.no

我在gitlab上有一个项目,我正试图推动一个承诺。我首先用https url克隆了该项目,但随后将其更改为ssh,然后运行
cat~/.ssh/id_rsa.pub
,它为我提供了ssh密钥:我已将密钥复制粘贴到gitlab配置文件中的ssh密钥,但在尝试推送提交时,我收到一条消息:

无法建立主机“gitlab”的真实性。RSA密钥 指纹是SHA256:cZiqgz2tMzLXftNIIXmQ9v+6M38xM1LzxROnDM1OJ0Q。 是否确实要继续连接(是/否)?对 警告:已将'07.no',myIpAddress'(RSA)永久添加到已知主机列表中。 权限被拒绝(公钥)

在运行
ssh-Tv时git@myEmail

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to myEmail [myIpAddress] port 22.
debug1: Connection established.
debug1: identity file /Users/myUser/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/myUser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-9etch3
debug1: match: OpenSSH_4.3p2 Debian-9etch3 pat OpenSSH_4* compat 0x00000000
debug1: Authenticating to myEmail:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<7680<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:Wcsi4VBAIf2M+M62Gx16W2yCR8rbtm9yh/WiQRe707o
debug1: Host 'myEmail' is known and matches the RSA host key.
debug1: Found key in /Users/myUser/.ssh/known_hosts:2
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/myUser/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/myUser/.ssh/id_dsa
debug1: Trying private key: /Users/myUser/.ssh/id_ecdsa
debug1: Trying private key: /Users/myUser/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
OpenSSH_7.4p1,LibreSSL 2.5.0
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:连接到myEmail[myIpAddress]端口22。
debug1:已建立连接。
debug1:identity file/Users/myUser/.ssh/id\u rsa类型1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id\u rsa-cert类型-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_dsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_dsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_ecdsa type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_ecdsa-cert type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_ed25519 type-1
debug1:key\u load\u public:没有这样的文件或目录
debug1:identity file/Users/myUser/.ssh/id_ed25519-cert type-1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_7.4
debug1:远程协议版本2.0,远程软件版本OpenSSH_4.3p2 Debian-9etch3
debug1:匹配:OpenSSH_4.3p2 Debian-9etch3 pat OpenSSH_4*compat 0x00000000
debug1:将myEmail:22身份验证为“git”
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:算法:diffie-hellman-group-exchange-sha1
debug1:kex:主机密钥算法:ssh-rsa
debug1:kex:server->client cipher:aes128 ctr MAC:hmac-sha1压缩:无
debug1:kex:client->server cipher:aes128 ctr MAC:hmac-sha1压缩:无

debug1:SSH2_MSG_KEX_DH_GEX_请求(2048它告诉您以前从未连接过此服务器。如果您希望这样,这是完全正常的。如果您患有妄想症,请使用备用通道验证密钥的校验和/指纹。(但请注意,可以重定向ssh连接的人也可以重定向web浏览器会话。)

如果您在此ssh安装之前已连接到此服务器,则可能是服务器已使用新密钥重新配置,或者有人正在欺骗服务器的身份。由于中间人攻击的严重性,它会警告您这种可能性

无论哪种方式,你都有一个安全的加密通道,没有指纹对应的私钥,任何人都无法解码你发送的信息


您用来对自己进行身份验证的密钥是不相关的……您不会希望将身份验证信息发送给可能会窃取它的欺诈服务器,因此您不应该期望根据您是要使用密码短语还是私钥登录而发生任何更改。您只是在这一过程中还没有走那么远。

是的,我没有以前尝试过连接,这是我第一次,但是,我无法推送任何东西,因此,我如何修复它?好的,它会警告您正在连接的新主机,因为@Rohit Poudel回答正确,但在您的编辑中还显示“权限被拒绝(公钥)”这表明GitLab无法识别密钥。您确定repo在您的用户帐户下,您可能也在其中添加了SSH密钥吗?另外,如果您运行
git remote-v
,它是否显示:
origingit@gitlab.com:您的\u用户\u帐户/您的\u回购
而不是对
https
的任何引用?它显示git@gitlabStackOverflow是一个关于编程和开发问题的网站。这个问题似乎是离题的,因为它与编程或开发无关。请参阅帮助中心。也许或将是一个更好的提问地方。