属鼠在使用https clone代码时一直报错如下:
fatal: unable to access 'https://github.com/xxx.git/': Received HTTP code 407 from proxy after CONNECT
原因是在这个容器上进行了代理的配置,但通过代理访问github时要验证身份,所以返回了http码407:身份未验证。
于是换一种方式,使用ssh来clone代码。
1.我们首先要在容器上生成一个身份验证密钥。使用命令:
ssh-keygen -t rsa
ssh-keygen: 生成密钥
-t: 选择密钥的类型 rsa: 密钥的一种类型
(linux下)生成后默认的私钥存储在/root/.ssh/id_rsa中,默认公钥存储在/root/.ssh/id_rsa.pub中。同时生成一个fingerprint。
2.接下来我们打开github --> Settings --> SSH and GPG keys, 点击new ssh keys:
Title自己随便取,Key要复制公钥,也就是存储在id_rsa.pub中的那个。
3.然后就可以通过ssh来clone代码啦
复制,然后 git clone xxxx [自己的仓库]。
结束~