我需要为特定的回购设置Jenkins + bitbucket集成。
回复如下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 "要使用默认名称或路径创建密钥,"没有密码。使用密码短语创建的早期ssh密钥不起作用
xclip -selection clipborad<的〜/ .ssh / my-new-ssh-key.pub 在bitbucket帐户SSH密钥下添加
xclip -selection clipborad<把〜/ .ssh /我 - 新的SSH密钥 在Jenkins凭证下添加了带有私钥的SSH用户名
答案 0 :(得分:0)
执行ssh -Tv git@git.companyName.com -p 7889
以查看实际使用哪个公钥成功连接到内部服务器。
然后确保公钥实际上是您在BitBucket帐户中注册的公钥。
如OP所述,使用带密码的密钥是一个问题。