在centos上git报错:Permission denied, please try again.

报错信息

报错日志:

[root@localhost apisix]# git clone git@git.snowballfinance.com:infra/apisix.git
正克隆到 'apisix'...
git@git.snowballfinance.com's password: 
Permission denied, please try again.
git@git.snowballfinance.com's password: 
[root@localhost apisix]# 

解决方法

按我如下的操作即可

[root@localhost apisix]# git --version
git version 1.8.3.1
[root@localhost apisix]# git config --global user.name "name"
[root@localhost apisix]# git config --global user.email "name@mail.com"
[root@localhost apisix]# ssh-keygen -t rsa -C "name@mail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ANo8TIeMuSpERQoaacTXN8h7GcstHnN3rJkLUJ5GW6E yangyue_intern@xueqiu.com
The key's randomart image is:
+---[RSA 2048]----+
|=oo*=.o    ..    |
|+=+Bo* + o..     |
|+.o.= = XE+ .    |
| ..  o @ B . o   |
|..    o S . =    |
|o      . . +     |
|.         . .    |
|           .     |
|                 |
+----[SHA256]-----+

# 默认会将ssh key生成到下面的这个目录中,按下面的操作即可
[root@localhost ~]# cd /root/.ssh
[root@localhost .ssh]# ls
id_rsa  id_rsa.pub  known_hosts
[root@localhost .ssh]# cat id_rsa.pub 
# 这里会出现字符内容
[root@localhost .ssh]# 


将cat出来的字符内容放入自己的ssh里面,如下图,在右边填入自己的key即可
在这里插入图片描述

[root@localhost apisix]# git clone git@git.snowballfinance.com:infra/apisix.git
正克隆到 'apisix'...
remote: Enumerating objects: 23807, done.
remote: Counting objects: 100% (23807/23807), done.
remote: Compressing objects: 100% (5265/5265), done.
remote: Total 23807 (delta 17624), reused 23763 (delta 17595), pack-reused 0
接收对象中: 100% (23807/23807), 23.19 MiB | 2.27 MiB/s, done.
处理 delta 中: 100% (17624/17624), done.
[root@localhost apisix]# ls
apisix  apisix.zip
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

?abc!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值