加入新公司 首先要配置cocospods,down代码下来。
在这个过程中遇到了这个问题
Pre-downloading: `JKBBS` from `git@bj-gitlab.jianke.com:client-jk-ios/JKBBS.git`, commit `d364e2b9be47a7047bf92bd66b91f8c5865685ad`
git@bj-gitlab.jianke.com's password:
git@bj-gitlab.jianke.com's password:
git@bj-gitlab.jianke.com's password:
[!] Error installing JKBBS
[!] Failed to download 'JKBBS': [!] /usr/bin/git clone git@bj-gitlab.jianke.com:client-jk-ios/JKBBS.git /var/folders/2k/67rhttk52tlbnl24_3zk346r0000gn/T/d20210326-15306-1jxvxzy --template=
Cloning into '/var/folders/2k/67rhttk52tlbnl24_3zk346r0000gn/T/d20210326-15306-1jxvxzy'...
Permission denied, please try again.
Permission denied, please try again.
git@bj-gitlab.jianke.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
代表我在download JKBBS 库的时候要求我输入密码,输了三次密码结果还是错误的。
重点在这句话 git@bj-gitlab.jianke.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
这表示我们需要自己配置 ssh的公钥和私钥,说实在的我是懵逼的,毕竟我没有配置过。来来来,看看步骤
1、 前往该目录 ~/.ssh
2、上面目录下如果只包含known_hosts 文件表示该mac上没有生成过 公钥和私钥
3、生成公钥私钥
①命令行操作到.ssh 文件夹下 cd ~/.ssh
②命令行 ssh-keygen -t rsa -C "your_email@example.com"
③依照提示 **输入文件夹名 和 邮箱 和 密码 **
至此,公钥私钥文件就生成了
注意:网上有说是 id_rsa.pub 和 id_dsa 这两个文件,你给文件名 取名叫 id_dsa 即可,我这里叫ssh_key
④ 复制 ssh_key.pub 文件内容: 命令行: pbcopy < ~/.ssh/ssh_key.pub
⑤ 将我们复制得来的 公钥 配置到git 中
到此 文章上面提到的问题就可以解决了,正常执行 pod update 操作或者 clone 操作即可。