本想拉取远程项目到本地
E:\files\github\gmdropship>git pull git@ip:username/ship_web.git
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
发现反复要求输入密码,输入的密码是对的,但仍然显示没有权限。
查看ssh 连接日志:
E:\files\github\gmdropship>ssh -vT git@ip
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Reading configuration data C:\\Users\\Micky/.ssh/config
debug1: Connecting to ip [ip] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ip:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:VUmEOh8FW/w2DaxFRH9SCrvIIF5j0dcEpxUy3Z7BtV4
debug1: Host 'ip' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\Micky/.ssh/known_hosts:4
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:B8BjflVLnBcR/eD2USLssP40zIZSbdj0o2Dl9aGFuOo C:\\Users\\Micky/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@ip's password:
Connection closed by ip port 22
【解决】
通过日志找到我们的公钥地址C:\Users\Micky\.ssh
,将公钥内容放到对于git平台上的 ssh
-keys设置上面即可。