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
Git请求SSH密码短语,即使存在于SSH代理中_Git_Ssh_Ssh Keys_Ssh Agent - Fatal编程技术网

Git请求SSH密码短语,即使存在于SSH代理中

Git请求SSH密码短语,即使存在于SSH代理中,git,ssh,ssh-keys,ssh-agent,Git,Ssh,Ssh Keys,Ssh Agent,我每天都在我的Mac上使用git和ssh代理,它可以完美地工作。然而,在我的远程开发服务器上,我应该错过一些东西,因为在执行远程git操作时,我不能绕过SSH密码提示 安装程序 ssh代理中列出了密钥: ssh添加-L: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCktk2+zRYGy0RdM6HJ8JFVPjiNknK7iN8ohdCGSX9fPQ.... /home/user/.ssh/id_rsa.from_user@server_to_git@bitb

我每天都在我的Mac上使用git和ssh代理,它可以完美地工作。然而,在我的远程开发服务器上,我应该错过一些东西,因为在执行远程git操作时,我不能绕过SSH密码提示

安装程序
  • ssh代理中列出了密钥:
    ssh添加-L

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCktk2+zRYGy0RdM6HJ8JFVPjiNknK7iN8ohdCGSX9fPQ.... 
    /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket
    
  • 密钥与
    ~/.ssh/config
    中的bitbucket关联:

    Host *
        IdentitiesOnly yes
        ServerAliveInterval 600
        ServerAliveCountMax 5
        TCPKeepAlive no
        IdentitiesOnly yes
    
    
    Host bitbucket bitbucket.org
       User git
       Hostname bitbucket.org
       KexAlgorithms diffie-hellman-group1-sha1
       Identityfile  /home/user/.ssh/id_rsa.user@server_to_git@bitbucket
    
    AddressFamily inet
    BatchMode no
    CheckHostIP yes
    Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
    Compression yes
    ForwardAgent no
    ForwardX11 no
    GSSAPIAuthentication no
    GSSAPIDelegateCredentials no
    Host *
        HashKnownHosts yes
        SendEnv LANG LC_*
    HostbasedAuthentication no
    KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
    MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
    PasswordAuthentication no
    PermitLocalCommand no
    Port 22
    Protocol 2
    RSAAuthentication yes
    RhostsRSAAuthentication no
    StrictHostKeyChecking ask
    Tunnel no
    
  • 环境变量
    导出| grep SSH_A

    SSH_AGENT_PID=30294
    SSH_AUTH_SOCK=/tmp/ssh-IS3rVQtFwDxF/agent.30292
    
  • 代理正在运行
    ps-e | grep-qssh-Agent&&echo“ssh-Agent正在运行”
    返回

    SSH Agent is running
    
    Enter passphrase for key '/home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket':
    
  • 权限
    ls-al~/.ssh

    total 48K
    drwx------  2 user user 4,0K oct.  30 18:22 .
    drwxr-xr-x 18 user user 4,0K nov.   7 11:52 ..
    -rw-------  1 user user  431 mai   10  2016 authorized_keys
    lrwxrwxrwx  1 user user   62 oct.  30 16:50 config -> /home/user/.dotfiles/machine-specific/base/ssh/config
    -rw-------  1 user user  134 mars  26  2017 environment-
    -rw-------  1 user user  137 nov.   7 11:22 environment-server
    -rw-------  1 user user 1,8K mai   16 13:38 id_rsa.from_user@server_to_git@bitbucket
    -rw-r--r--  1 user user 2,6K oct.  30 11:02 known_hosts
    
  • 我的“加固的”
    /etc/ssh/ssh\u配置

    Host *
        IdentitiesOnly yes
        ServerAliveInterval 600
        ServerAliveCountMax 5
        TCPKeepAlive no
        IdentitiesOnly yes
    
    
    Host bitbucket bitbucket.org
       User git
       Hostname bitbucket.org
       KexAlgorithms diffie-hellman-group1-sha1
       Identityfile  /home/user/.ssh/id_rsa.user@server_to_git@bitbucket
    
    AddressFamily inet
    BatchMode no
    CheckHostIP yes
    Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
    Compression yes
    ForwardAgent no
    ForwardX11 no
    GSSAPIAuthentication no
    GSSAPIDelegateCredentials no
    Host *
        HashKnownHosts yes
        SendEnv LANG LC_*
    HostbasedAuthentication no
    KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
    MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
    PasswordAuthentication no
    PermitLocalCommand no
    Port 22
    Protocol 2
    RSAAuthentication yes
    RhostsRSAAuthentication no
    StrictHostKeyChecking ask
    Tunnel no
    
  • 然而
  • 运行
    git克隆bitbucket:team/project.git
    返回

    SSH Agent is running
    
    Enter passphrase for key '/home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket':
    
  • 调试
  • 结果
    ssh-v位桶

    OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
    debug1: Reading configuration data /home/user/.ssh/config
    debug1: /home/user/.ssh/config line 1: Applying options for *
    debug1: /home/user/.ssh/config line 10: Applying options for bitbucket
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 12: Applying options for *
    debug1: Hostname has changed; re-reading configuration
    debug1: Reading configuration data /home/user/.ssh/config
    debug1: /home/user/.ssh/config line 1: Applying options for *
    debug1: /home/user/.ssh/config line 10: Applying options for bitbucket.org
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 12: Applying options for *
    debug1: Connecting to bitbucket.org [104.192.143.2] port 22.
    debug1: Connection established.
    debug1: identity file /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket type -1
    debug1: identity file /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket-cert type -1
    debug1: identity file /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket type -1
    debug1: identity file /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
    debug1: Remote protocol version 2.0, remote software version conker_1.0.314-df0526e app-132
    debug1: no match: conker_1.0.314-df0526e app-132
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-gcm@openssh.com <implicit> none
    debug1: kex: client->server aes128-gcm@openssh.com <implicit> none
    debug1: sending SSH2_MSG_KEXDH_INIT
    debug1: expecting SSH2_MSG_KEXDH_REPLY
    debug1: Server host key: RSA 97:8c:hidden:hidden:....
    debug1: Host 'bitbucket.org' is known and matches the RSA host key.
    debug1: Found key in /home/user/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket
    debug1: key_parse_private2: missing begin marker
    debug1: key_parse_private_pem: PEM_read_PrivateKey failed
    debug1: read PEM private key done: type <unknown>
    Enter passphrase for key '/home/user/.ssh/id_rsa.from_user@server_to_git@bitbucket':
    
    OpenSSH_6.6.1、OpenSSL 1.0.1f 2014年1月6日
    debug1:正在读取配置数据/home/user/.ssh/config
    debug1:/home/user/.ssh/config第1行:应用*
    debug1:/home/user/.ssh/config第10行:为bitbucket应用选项
    debug1:读取配置数据/etc/ssh/ssh\u config
    debug1:/etc/ssh/ssh\u配置第12行:应用*
    debug1:主机名已更改;重读配置
    debug1:正在读取配置数据/home/user/.ssh/config
    debug1:/home/user/.ssh/config第1行:应用*
    debug1:/home/user/.ssh/config第10行:为bitbucket.org应用选项
    debug1:读取配置数据/etc/ssh/ssh\u config
    debug1:/etc/ssh/ssh\u配置第12行:应用*
    debug1:连接到bitbucket.org[104.192.143.2]端口22。
    debug1:已建立连接。
    debug1:identity file/home/user/.ssh/id\u rsa.from_user@server_to_git@比特桶类型-1
    debug1:identity file/home/user/.ssh/id\u rsa.from_user@server_to_git@bitbucket证书类型-1
    debug1:identity file/home/user/.ssh/id\u rsa.from_user@server_to_git@比特桶类型-1
    debug1:identity file/home/user/.ssh/id\u rsa.from_user@server_to_git@bitbucket证书类型-1
    debug1:启用协议2.0的兼容模式
    debug1:本地版本字符串SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
    调试1:远程协议版本2.0,远程软件版本conker_1.0.314-df0526e app-132
    调试1:不匹配:conker_1.0.314-df0526e app-132
    debug1:SSH2\u MSG\u KEXINIT已发送
    debug1:SSH2\u MSG\u KEXINIT已收到
    debug1:kex:server->client aes128-gcm@openssh.com没有一个
    debug1:kex:client->server aes128-gcm@openssh.com没有一个
    debug1:发送SSH2\u MSG\u KEXDH\u INIT
    debug1:需要SSH2\u MSG\u KEXDH\u回复
    debug1:服务器主机密钥:RSA 97:8c:隐藏:隐藏:。。。。
    debug1:主机“bitbucket.org”是已知的,并且与RSA主机密钥匹配。
    debug1:在/home/user/.ssh/known_hosts中找到密钥:1
    debug1:ssh\u rsa\u验证:签名正确
    debug1:SSH2\u MSG\u已发送新密钥
    debug1:应为SSH2\u MSG\u NEWKEYS
    debug1:SSH2\u MSG\u接收到新密钥
    debug1:SSH2\u消息\u服务\u请求已发送
    debug1:SSH2\u消息\u服务\u接收
    debug1:可以继续的身份验证:公钥
    debug1:下一个身份验证方法:公钥
    debug1:正在尝试私钥:/home/user/.ssh/id\u rsa.from_user@server_to_git@比特桶
    debug1:键\u解析\u私有2:缺少开始标记
    debug1:密钥\解析\私有\ pem:pem\读取\私有密钥失败
    debug1:读取PEM私钥完成:类型
    输入密钥“/home/user/.ssh/id\u rsa.from”的密码短语_user@server_to_git@比特桶':
    

  • 有什么提示吗?

    我刚刚发现
    identity only
    需要公钥才能在本地机器上工作