问题:无法使用Git从Windows推送到Linux。 也不能通过SSH连接到git用户。
更新#1:我将“PasswordAuthentication”更改为no并进行了testing。 密钥没有工作,但密码。 显然必须是与ssh-rsa密钥有关。
更新#2:尝试生成一个全新的密钥,这是从我的用户帐户上的不同。 仍然拒绝的关键,同样的问题。
更新#3:问题解决了,答案已经发布。 日志实际上是无用的,因为我正在使用无法读取.ppk文件的程序。
运行CentOS 6.4,整个驱动器被encryption,主文件夹不encryption。
我在Windows上使用git推到服务器上的git仓库。 基本上遵循这个: http : //git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server
我已经在fedora和debian上正常工作了,但不知道这里发生了什么。 我认为可能的第一件事是主文件夹被encryption,但文件夹没有encryption。
我试图再次复制密钥,并删除用户,并将其添加回来。 我尝试使用SSH连接到'混帐'用户,我得到了下面的日志。 不完全确定是什么造成的问题。
这是我的Windows机器上的configuration文件。
取&拉是:ssh://name1/opt/git/git.project
configuration文件:
Host name1 HostName name2.com Port 12345 User git IdentityFile ~/.ssh/private_key.ppk
这是发生了什么事情:
USER_NAME@MY-PC ~/Documents/Workspace/git.project (master) $ ssh -vT -p 12345 -i "C:/Users/USER_NAME/.ssh/private_key.ppk" git@WEB_NAME. com OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /c/Users/USER_NAME/.ssh/config debug1: Connecting to WEB_NAME.com [--.--.--.--] port 12345. debug1: Connection established. debug1: identity file C:/Users/USER_NAME/.ssh/private_key.ppk type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.6 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host '[WEB_NAME.com]:12345' is known and matches the RSA host key. debug1: Found key in /c/Users/USER_NAME/.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,gssapi-keyex,gssapi-with-mi c debug1: Next authentication method: publickey debug1: Trying private key: C:/Users/USER_NAME/.ssh/private_key.ppk debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key 'C:/Users/USER_NAME/.ssh/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key 'C:/Users/USER_NAME/.ssh/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key 'C:/Users/USER_NAME/.ssh/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> debug1: No more authentication methods to try. Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
更新日志:
USER_NAME@MY-PC /c/Windows/system32 $ ssh -vT -v -v -p SSH_PORT -i "C:/Users/USER_NAME/.ssh/git/private_key.ppk" gi t@WEB_NAME.com OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /c/Users/USER_NAME/.ssh/config debug2: ssh_connect: needpriv 0 debug1: Connecting to WEB_NAME.com [--.--.--.--] port SSH_PORT. debug1: Connection established. debug3: Not a RSA1 key file C:/Users/USER_NAME/.ssh/git/private_key.ppk. debug2: key_type_from_name: unknown key type 'PuTTY-User-Key-File-2:' debug3: key_read: missing keytype debug2: key_type_from_name: unknown key type 'Encryption:' debug3: key_read: missing keytype debug2: key_type_from_name: unknown key type 'Comment:' debug3: key_read: missing keytype debug2: key_type_from_name: unknown key type 'Public-Lines:' debug3: key_read: missing keytype debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug2: key_type_from_name: unknown key type 'Private-Lines:' debug3: key_read: missing keytype debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug3: key_read: missing whitespace debug2: key_type_from_name: unknown key type 'Private-MAC:' debug3: key_read: missing keytype debug1: identity file C:/Users/USER_NAME/.ssh/git/private_key.ppk type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.6 debug2: fd 3 setting O_NONBLOCK debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-g roup-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa,ssh-dss debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1 28,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-c tr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour1 28,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-c tr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open ssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@open ssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-g roup-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa,ssh-dss debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour12 8,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rij [email protected] debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour12 8,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rij [email protected] debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160 ,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160 ,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: mac_init: found hmac-md5 debug1: kex: server->client aes128-cbc hmac-md5 none debug2: mac_init: found hmac-md5 debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug2: dh_gen_key: priv key bits set: 123/256 debug2: bits set: 507/1024 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug3: put_host_port: [--.--.--.--]:SSH_PORT debug3: put_host_port: [WEB_NAME.com]:SSH_PORT debug3: check_host_in_hostfile: filename /c/Users/USER_NAME/.ssh/known_hosts debug3: check_host_in_hostfile: match line 1 debug3: check_host_in_hostfile: filename /c/Users/USER_NAME/.ssh/known_hosts debug3: check_host_in_hostfile: match line 1 debug1: Host '[WEB_NAME.com]:SSH_PORT' is known and matches the RSA host key. debug1: Found key in /c/Users/USER_NAME/.ssh/known_hosts:1 debug2: bits set: 532/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: C:/Users/USER_NAME/.ssh/git/private_key.ppk (0x0) debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-m ic,password debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Trying private key: C:/Users/USER_NAME/.ssh/git/private_key.ppk debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> Enter passphrase for key 'C:/Users/USER_NAME/.ssh/git/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> debug2: bad passphrase given, try again... Enter passphrase for key 'C:/Users/USER_NAME/.ssh/git/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> debug2: bad passphrase given, try again... Enter passphrase for key 'C:/Users/USER_NAME/.ssh/git/private_key.ppk': debug1: PEM_read_PrivateKey failed debug1: read PEM private key done: type <unknown> debug2: bad passphrase given, try again... debug2: we did not send a packet, disable method debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password /* Password debugging deleted -- useless -- Zeveso */ debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
步骤1:
chmod 700 ~/.ssh
第2步:
chmod 600 ~/.ssh/authorized_keys
第3步:
sed -i 's|#AuthorizedKeysFile|AuthorizedKeysFile|g' /etc/ssh/sshd_config sed -i 's|.ssh/authorized_keys|%h/.ssh/authorized_keys|g' /etc/ssh/sshd_config
注意:根据需要添加“sudo”。
我从来没有这样做与其他Linux发行版,真的很惊讶,我需要做到这一点。