本文分享如何生成 SSH Key 并添加到极狐GitLab 中,然后用 SSH Key 进行代码拉取。
极狐GitLab 是 GitLab 在中国的发行版,可以私有化部署,对中文的支持非常友好,是专为中国程序员和企业推出的企业级一体化 DevOps 平台,一键就能安装成功。安装详情可以查看官网指南。
SSH Key 对于通过 ssh 来进行极狐GitLab 代码拉取是重要的,完成整个流程一般分为三步:
- SSH Key 的生成
- 添加 SSH Key 到极狐GitLab 中
- 使用 ssh 克隆代码
第一步:生成 SSH Key
使用 ssh-keygen命令来生成 SSH Key:
ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa_jh_gitlab
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa_jh_gitlab
Your public key has been saved in /root/.ssh/id_rsa_jh_gitlab.pub
The key fi