当前位置:   article > 正文

【已解决】git clone 报错:Could not read from remote repository. Please make sure you have the correct acce_fatal: could not read from remote repository. plea

fatal: could not read from remote repository. please make sure you have the


一、问题

换电脑了,克隆代码遇到报错:

git clone git@codeup.aliyun.com:qwertyuiopasdfghjkl/projectName.git
Cloning into 'projectName'...
找不到代码库,请确认是否有权限且代码库路径正确
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

找到本地公钥,复制到添加 SSH 公钥处,遇到报错:

该密钥已被添加为用户密钥或部署密钥,添加失败
  • 1

官方提出的解决办法:添加 SSH Keys 报已存在怎么办?
按照官方的提示,大概率是原因1,只能重新生成了

但是现在本地这个 SSH Key 在其他地方有使用(Gitee/Github/…),想要保留,再生成一个。

二、解决

按照以下两篇官方说明:

决定尝试 ED25519 算法生成的密钥(同一算法需要指定不同路径,使用不同算法就免了)

ssh-keygen -t ed25519 -C "<注释内容>"
  • 1

按照默认路径生成后,配置config文件(~/.ssh/config)

# Codeup (2023.05.18 add)
HostName codeup.aliyun.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_ed25519
  • 1
  • 2
  • 3
  • 4

当本地存在多个密钥,如果不设置认证规则,本机将随机选择一个密钥用于认证,可能造成认证失败。

接下来复制公钥粘贴到指定位置

# Windows
cat ~/.ssh/id_ed25519.pub | clip
  • 1
  • 2

保存后就可以使用啦

三、拓展学习

1.ssh命令

  • 远程登录(查看当前使用的密钥对应的账号)
ssh -t git@codeup.aliyun.com
  • 1

正常显示:

Welcome to Codeup, userName!
Connection to codeup.aliyun.com closed.
  • 1
  • 2

SSH(远程登录)

2.Ed25519:一个高速度高安全的签名方法

  • Ed25519:一个高速度高安全的签名方法
  • 官方介绍:Introduction
  • 它的签名长度为64个字节,公钥长度是32个字节

签名一共经过三个环节

  1. 生成公钥、私钥
  2. 使用私钥签名
  3. 使用公钥验签

over

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/918444
推荐阅读
相关标签
  

闽ICP备14008679号