git submodule update安装/升级模块的github配置

时间:2021-12-23 14:21:30

有时候需要使用git submodule update来对依赖模块进行安装/升级,有时候会被github禁止掉。这时候需要配置自己本机的github。

1、设置git

git config  - -global user.name  "Renyangbiao"

git config  - -global user.email  "r.yanb@icloud.com"

注:引号里的根据自己实际情况,不重要。

2、进入.ssh文件

cd  ~/.ssh

看看是否已经有了id_rsa和id_rsa.pub文件,如果有就备份删除。

3、生成ssh key

ssh-keygen  -t  rsa -C "r.yanb@icloud.com"

三次回车,生成id_rsa和id_rsa.pub两个文件,其中id_rsa.pub为公钥。

4、将公钥放到github中去

cat id_rsa.pub

将内容复制,然后登陆自己的github,账户->Settings->SSH  and GPG Keys->New SSH key,粘贴。

5、测试是否成功

ssh git@github.com

刚才添加的SSH key变绿表示成功!