关于Gitlab拉取代码没权限的解决方法

最近,在拉取同事的代码时,由于工程依赖了公司的私有仓库代码,再更新的时候爆了没有权限的错误。

GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

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

排查了很久,也不知道什么问题,于是决定重新生成SSH并进行配置。首先,我们按照生成SSH的规则,

git config --global user.name "你的名字"
git config --global user.email“你的邮箱"

然后,使用如下的命令生成rsa。

ssh-keygen -t rsa -C "姓名/邮箱"

注意:生成rsa的时候不要输入密码,因为我们拉取私有仓库是没有配置密码的,如果配置了,就提示前面的错误。最后,将生成的id_rsa.pub中的内容拷贝到Gitlab上就可以了。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/xiangzhihong8/article/details/126059813
今日推荐