【问题标题】:gitlab public-key refused on git clone requestgitlab 公钥在 git clone 请求中被拒绝
【发布时间】:2019-02-20 16:53:56
【问题描述】:

我知道以前可能有人问过这个问题,但我找不到任何解决我的问题的方法。问题是,当我尝试通过 ssh 克隆存储库时,它只会拒绝我的公钥。


 dorin@dorin-All-Series  ~  git clone git@gitlab.rankingcoach.com:d.jivoin/redis_ansible.git
Cloning into 'redis_ansible'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

The result is the same if I use my username:

 ✘ dorin@dorin-All-Series  ~  ssh -vT git@gitlab.rankingcoach.com    
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.rankingcoach.com [176.9.54.190] port 22.
debug1: Connection established.
debug1: identity file /home/dorin/.ssh/id_rsa type 1
debug1: identity file /home/dorin/.ssh/id_rsa-cert type -1
debug1: identity file /home/dorin/.ssh/id_dsa type -1
debug1: identity file /home/dorin/.ssh/id_dsa-cert type -1
debug1: identity file /home/dorin/.ssh/id_ecdsa type -1
debug1: identity file /home/dorin/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/dorin/.ssh/id_ed25519 type -1
debug1: identity file /home/dorin/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.12
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.7
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.7 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-sha1-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA b1:2b:32:4a:56:09:26:98:50:06:74:b8:77:eb:6b:81
debug1: Host 'gitlab.rankingcoach.com' is known and matches the ECDSA host key.
debug1: Found key in /home/dorin/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/dorin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/dorin/.ssh/id_dsa
debug1: Trying private key: /home/dorin/.ssh/id_ecdsa
debug1: Trying private key: /home/dorin/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我什至尝试重建授权密钥,但结果是一样的......

【问题讨论】:

  • 您是否生成了您的公共 SSH 密钥
  • 你好@skaul05 是的,我有并将公钥(id_rsa.pub)添加到gitlab
  • 谢谢,成功了。

标签: git ssh gitlab


【解决方案1】:

您的 Git URL 必须已更改。
使用以下命令更改本地目录中的 URL:

git remote set-url origin git@gitlab.rankingcoach.com:d.jivoin/redis_ansible.git

希望这能回答你的问题!!!

【讨论】:

    猜你喜欢
    • 2021-11-11
    • 2010-12-21
    • 1970-01-01
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多