29599

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.

Recommend

  • Running gitlab and gitlab-shell separately
  • gitlab in docker behind traefik proxy fails (usually)
  • Jenkins slave set-up - both master and slave nodes are Linux machines
  • Jenkins not showing on Ubuntu through google cloud
  • white-space: pre-wrap not working in IE
  • PHP problems with current url
  • disablinging autorecover option for powepoint
  • PHP: Get HTTP Protocol Version (HTTP/1.1 vs HTTP/2)
  • UIImagePickerControllerDelegate Methods Not Called When Delegate Not UIViewController
  • Perl keyword say is not working in version 5.14.4
  • FragmentActivity with a Fragment Containing a MapView
  • Base64 as method of sanitizing user input for Mysql
  • Can my app be notified when another application starts/stops playing audio?
  • Synchronize windows folders
  • BeautifulSoup difference between findAll and findChildren
  • Getting media player state in windows phone 7
  • configure: error: no acceptable C compiler found in $PATH
  • C# fibonacci function returning errors
  • How to get current document uri in XSLT?
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • What is the purpose of TaskExecutor in spring?
  • Eclipse CDT error: Unable to compile
  • ADO and msqli connections very slow
  • How do I get HTML corresponding to current DOM tree?
  • PHP buffered output depending on server setting?
  • SignalR .NET Client Invoke throws an exception
  • Azure Cloud Service Web Role web pages do not load
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • How to show dropdown in excel using jrxml (jasper api)?
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • How to include full .NET prerequisite for Wix Burn installer
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • apache spark aggregate function using min value
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize