git clone Permission denied, user: '–git' fatal: Could not read from remote repository.

1 快速解决

对于报错fatal: Could not read from remote repository.,网上一般都通过添加ssh密钥解决。但我遇到的多了一条Permission denied, user: '–git',这条报错中的“方框”在终端不可见,就是这个方框导致用户名错误。这个方框就隐藏在命令git clone git@...的“clone”和“git@”中间,把它删除即可。

2 详细说明

报错实际是这样的:

$ git clone –git@gitee.com:santion/altera-alinx-ax301.git
Cloning into 'altera-alinx-ax301'...
Permission denied, user: '–git'

fatal: Could not read from remote repository.

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

而看到的是这样的:
image
“方框”在终端不可见,所以不会想到这里有问题。
Permission denied译为拒绝访问或没有权限。一个错的用户自然没有权限。

3 参考

https://blog.csdn.net/weixin_39278265/article/details/107714238

posted @ 2022-07-23 13:03  立秋了  阅读(264)  评论(0编辑  收藏  举报