新PC安装git和Android studio以后尝试拉取代码自己分支的代码会出现下面的错误
23:43 Update failed
Warning: Permanently added 'gitlab.com,172.65.251.78' (ECDSA) to the list of known hosts.
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
出现的原因是SSH key没有配置好:
1.首先输入下面的命令
1)ssh-keygen -t rsa -C "12345@outlook.com"
2)输入回车
3)输入回车
会出现下面的命令:
2.查看.ssh目录下面生成的id_rsa.pub文件
3.去C:/用户目录/.ssh下将公钥添加到gitlab的网站中,即id_rsa.pub文件的内容
4.直接将id_rsa.pub中的内容复制到key中。(title不需要手动填写,如果正确复制的key,titie会自动填上,如果没填上很可能需要手动去掉转行符)
再输入git pull的时候可以拉取到最新的代码了