前端开发从进项目,代码有几周没提交了,公司管理员给分配了gitlab的权限,就帮他弄下,结果一直报如下错误:前端
Please make sure you have the correct access rights and the repository exists.linux
git clone git@gitlab.cpirhzl.com:ruanjianlaowang/web.git c:\Users\软件老王\Desktop\web --progress
Host key verification failed.
fatal: Could not read from remote repository.git
从报错信息看,要么远程仓库地址不对,要么是没有权限,从新生成秘钥了和检查地址了好屡次,就是不行,弄的有点怀疑人生了,最后忽然发现问题所在,记录下,但愿能帮到朋友们。web
地址:windows
https://git-scm.com/download/win
下载后exe文件,直接next、next到最后一步,所有默认安装就行了。ssh
(1)## 生成ssh密钥 ssh-keygen -t rsa -C <your email> 例如:ssh-keygen -t rsa -C ruanjianlaowang@163.com (2)# 一路回车保存为默认名字 Enter file in which to save the key (/home/raunjianlaowang/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: (3)## 会自动生成两个文件 ## 私钥文件:id_rsa 公钥文件:id_rsa.pub # windows C:\Users\登录用户名称\.ssh 例如老王的: C:\Users\Administrator\.ssh linux /home/ruanjianlaowang/.ssh
以ssh-rsa 开头,直接所有复制粘贴:ide
登录帐户右上角的设置->ssh秘钥->复制公钥到空白框中添加便可。gitlab
项目主要是在idea中使用的,如下这一步刚开始咱们没作,不过在找问题的有朋友提到多是这个问题,也随便作了作,不过之前记得是没有这样作的。idea
# 检查项目/全局 git配置 git config --global --list # 修改git帐号为远程仓库帐号密码 git config --global user.name <your name> git config --global user.email <your email>
为何很简答的操做,反复确认了仍是报:Please make sure you have the correct access rights and the repository exists呢?code
Enter file in which to save the key (/home/raunjianlaowang/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:
问题出在了这一步了,Enter passphrase,这里输入了帐户密码,致使在idea中一直报没有权限,可是idea却没有提示要录入密码,后面经过git命令拉取的时候,弹出让输入密码,输入竟然好了,才发现这里要直接回车,不能输入密码,不然idea中就没法拉取远程仓库的代码。
Enter passphrase要直接回车,不能录入密码!
Enter passphrase要直接回车,不能录入密码!
Enter passphrase要直接回车,不能录入密码!