Permission denied (publickey,gssapi-keyex,gssapi-w

2019-08-15 03:30发布

问题:

I am trying to push my project to git but at the time of push I'm getting

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository .

I've created the ssh key and added that to git SSH Keys under profile Settings using git's UI. Actually IDK why but I'm asked to enter password while pushing even after adding keys to the git.Any help please?

ssh -vT git@git.companyname.com stack

$ ssh -vT git@git.companyname.com
OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to git.companyname.com [198.41.85.18] port 22.
debug1: Connection established.
debug1: identity file /c/Users/user1/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/user1/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to git.companyname.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<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:GeFkVDzGN7W8Ngp/osU5gqDL5jdf6GDgF8lLPWapDU8
debug1: Host 'git.companyname.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/user1/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
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 RSA public key: /c/Users/user1/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /c/Users/user1/.ssh/id_dsa
debug1: Trying private key: /c/Users/user1/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/user1/.ssh/id_ed25519
debug1: Next authentication method: password
git@git.companyname.com's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
git@git.companyname.com's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
git@git.companyname.com's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Edit: ls -la output:

drwxr-xr-x 1 user-1 11049089 0 Feb 9 18:54 ./ 
drwxr-xr-x 1 user-1 1049089 0 Feb 9 20:58 ../ 
-rw-r--r-- 1 user-1 1049089 405 Feb 9 16:26 pub 
-rw-r--r-- 1 user-1 1049089 2489 Feb 9 21:01 authorized_keys 
-rw-r--r-- 1 user-1 1049089 1679 Feb 9 20:15 id_rsa 
-rw-r--r-- 1 user-1 1049089 405 Feb 9 20:15 id_rsa.pub 
-rw-r--r-- 1 user-1 1049089 788 Feb 9 19:31 known_hosts 
-rw-r--r-- 1 user-1 1049089 407 Feb 9 15:59 known_hosts.old

Edit: Created key using

$ ssh-keygen -t rsa -C "username@company.com"

Added the .pub file to authorized_key using

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys