
bitbucket ssh connection issue “shell request failed on channel 0.” even though I can commit to this
Question:
I need to setup Jenkins + bitbucket integration for particular repo.
repo is as below
origin ssh://git@git.companyName.com:7999/ta/wa-automation.git (fetch)
origin ssh://git@git.companyName.com:7999/ta/wa-automation.git (push)
I can clone this repo, commit to it without entering email and password
But when I try command
ssh -T git@bitbucket.org
Permission denied (publickey).
ssh -T git@bitbucket.companyName.com
Permission denied (publickey).
ssh -Tv git@git.companyName.com -p 7999
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to git.companyName.com [xx.xx.xxx.xx] port 7999.
debug1: Connection established.
debug1: identity file /home/vingleshwar/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vingleshwar/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version SSHD-UNKNOWN
debug1: no match: SSHD-UNKNOWN
debug1: Authenticating to git.companyName.com:7999 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256
compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256
compression: none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa
SHA256:ydycrDWOZA8h7jHiLQRh9dxRXC0cnx+rw
debug1: Host '[git.companyName.com]:7999' is known and matches the RSA host key.
debug1: Found key in /home/vingleshwar/.ssh/known_hosts:4
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/vingleshwar/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to git.companyName.com ([xx.xx.xxx.xx]:7999).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_PAPER = de_DE.UTF-8
debug1: Sending env LC_ADDRESS = de_DE.UTF-8
debug1: Sending env LC_MONETARY = de_DE.UTF-8
debug1: Sending env LC_NUMERIC = de_DE.UTF-8
debug1: Sending env LC_TELEPHONE = de_DE.UTF-8
debug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_MEASUREMENT = de_DE.UTF-8
debug1: Sending env LC_TIME = de_DE.UTF-8
debug1: Sending env LC_NAME = de_DE.UTF-8
shell request failed on channel 0
I don't have admin access to company's bitbucket server.
<a href="https://bitbucket.companyName.com/plugins/servlet/ssh/account/keys" rel="nofollow">https://bitbucket.companyName.com/plugins/servlet/ssh/account/keys</a> has got public key entry
How to fix this issue ?
[Solution] - Below accepted answer helped to debug and fix as below
<ul><li><a href="https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html" rel="nofollow">https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html</a> "To create a key with a name or path other than the default," without passphrase. Earlier ssh keys created with passphrase didn't work
</li> <li>xclip -selection clipborad < ~/.ssh/my-new-ssh-key.pub added under bitbucket Account SSH keys
</li> <li>xclip -selection clipborad < ~/.ssh/my-new-ssh-key added under Jenkins credentials SSH username with private key
</li> </ul>Answer1:Do a ssh -Tv git@git.companyName.com -p 7889
to see what public key is actually used to connect successfully to your internal server.
Then make sure that public key is actually the one registered in your BitBucket account.
As mentioned by the OP, using a key with passphrase was an issue.