gpt4 book ai didi

git - bitbucket ssh 连接问题 "shell request failed on channel 0."即使我可以提交这个 repo

转载 作者:行者123 更新时间:2023-12-02 14:07:17 24 4
gpt4 key购买 nike

我需要为特定的 repo 设置 Jenkins + bitbucket 集成。

repo 如下

origin  ssh://git@git.companyName.com:7999/ta/wa-automation.git (fetch)
origin ssh://git@git.companyName.com:7999/ta/wa-automation.git (push)

我可以克隆这个 repo,在不输入电子邮件和密码的情况下提交它

但是当我尝试命令时
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

我没有对公司的 bitbucket 服务器的管理员访问权限。

https://bitbucket.companyName.com/plugins/servlet/ssh/account/keys
有公钥入口

如何解决这个问题?

[解决方案]
- 下面接受的答案有助于调试和修复如下
  • https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
    “使用非默认名称或路径创建 key ”,不带密码。早期使用密码创建的 ssh key 不起作用
  • xclip -selection 剪贴板 < ~/.ssh/my-new-ssh-key.pub
    在 bitbucket 帐户 SSH key 下添加
  • xclip -selection 剪贴板 < ~/.ssh/my-new-ssh-key
    在 Jenkins 凭据下添加 SSH 用户名和私钥
  • 最佳答案

    做一个ssh -Tv git@git.companyName.com -p 7889查看实际使用什么公钥来成功连接到您的内部服务器。

    然后确保公钥实际上是在您的 BitBucket 帐户中注册的那个。

    正如 OP 所提到的,使用带有密码短语的 key 是一个问题。

    关于git - bitbucket ssh 连接问题 "shell request failed on channel 0."即使我可以提交这个 repo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48264136/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com