git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

本文记录了在尝试从远程仓库拉取项目时遇到的权限拒绝问题及解决过程。通过查看SSH连接日志,发现公钥认证失败,并最终通过正确配置公钥解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本想拉取远程项目到本地

E:\files\github\gmdropship>git pull git@ip:username/ship_web.git
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

发现反复要求输入密码,输入的密码是对的,但仍然显示没有权限。
查看ssh 连接日志:

E:\files\github\gmdropship>ssh -vT git@ip
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Reading configuration data C:\\Users\\Micky/.ssh/config
debug1: Connecting to ip [ip] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ip:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:VUmEOh8FW/w2DaxFRH9SCrvIIF5j0dcEpxUy3Z7BtV4
debug1: Host 'ip' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\Micky/.ssh/known_hosts:4
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
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 public key: RSA SHA256:B8BjflVLnBcR/eD2USLssP40zIZSbdj0o2Dl9aGFuOo C:\\Users\\Micky/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@ip's password:
Connection closed by ip port 22

【解决】
通过日志找到我们的公钥地址C:\Users\Micky\.ssh,将公钥内容放到对于git平台上的 ssh
-keys设置上面即可。

转载于:https://www.cnblogs.com/vicodona/p/11194909.html

Started by user zzl Running as SYSTEM Building in workspace /var/lib/jenkins/workspace/ruoyi The recommended git tool is: NONE using credential b3b80ec1-c9a6-4dcc-96f6-a06af4609ae3 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/ruoyi/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url git@192.168.254.11:zzl/rouyi.git # timeout=10 Fetching upstream changes from git@192.168.254.11:zzl/rouyi.git > git --version # timeout=10 > git --version # 'git version 1.8.3.1' using GIT_SSH to set credentials Verifying host key using known hosts file > git fetch --tags --progress git@192.168.254.11:zzl/rouyi.git +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision ce3d6ec6001acce71745489686c6d74c893e5f6e (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f ce3d6ec6001acce71745489686c6d74c893e5f6e # timeout=10 Commit message: "213" > git rev-list --no-walk ce3d6ec6001acce71745489686c6d74c893e5f6e # timeout=10 [ruoyi] $ /bin/sh -xe /tmp/jenkins9596733342913347267.sh + sudo ssh root@192.168.254.12 ./maven-deploy.sh Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). 192.168.254.13 /app create sucessful!!! Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). lost connection Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). 192.168.254.14 /app create sucessful!!! Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). lost connection Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Permission denied, please try again. Permission denied, please try again. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). Build step 'Execute shell' marked build as failure Finished: FAILURE
最新发布
08-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值