Gitlab配置SSH访问
note
适用的操作环境
*nix / mac
- 生成公钥
ssh-keygen -t rsa -f ~/.ssh/id_rsa.self -C "邮箱"
在GitLab中注册公钥
Settings
->SSH keys
中,增加公钥(id_rsa.self.pub)内容生成并编辑
~/.ssh/config
cd ~/.ssh
touch config
vim config
在config
文件中,输入:
host [别名]
hostname [gitlab访问地址(域名/ip:端口)]
user [gitlab的登录名]
IdentityFile ~/.ssh/id_rsa.self
- 验证
ssh -T git@47.115.47.218
输出结果:
Welcome to GitLab, @leon!