#  Error-Git: Permission denied (publickey). fatal: Could not read from remote repository.

## 环境

– Windows 10
- git version 2.30.0.windows.1
– sameersbn/gitlab:13.10.3

## 现象

有一天修改完项目代码,执行git push,报错如下:

git@gitlab.service.afa.ai: Permission denied (publickey).
fatal: Could not read from remote repository.

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

## 原因

1. 不太确定原因
2. 有人说是公钥过期,我不太清楚

## 修复

1. 重新生成key,并添加到gitlab
```
cd ~/.ssh
ssh-keygen -f git
cat git.pub
vim config
```

config文件的路径更新,并打开gitlab,添加新公钥到SSH Keys.

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。