git 使用ssh 克隆代码出现 Permission denied 错误

文章讲述了在GitLab环境中,尽管A地址的SSH密钥(id_rsa.pub)配置正常,但尝试从B地址克隆代码时遇到Permissiondenied错误。作者提供了创建.ssh/config文件以支持多GitLab克隆的解决方案,强调了设置正确访问权限的重要性。

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

场景:
A B两个gitlab地址,A地址配置了id_rsa.pub 可以拉代码,github配置了也没问题,但是在B的gitlab中配置id_rsa.pub使用ssh克隆代码就会出现
Permission denied的错误,

Permission denied, please try again.
git@127.0.0.1's password:
git@127.0.0.1: 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.

参考链接:

https://blog.51cto.com/u_14201949/5996117

在自己的.ssh 目录下创建config文件使支持多gitlab克隆代码

Host *
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值