0x1 安装完毕GitLab以后我们创建项目通过SSH协议克隆到本地
遇到的问题
配置好了SSH-KEY但是还是不能免密 克隆项目到本地
0x2 解决方案
修改GitLab配置文件 vim /etc/gitlab/gitlab.rb
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
修改456行 打开注释 开放 gitlab_shell_ssh_port端口22
修改56行 去除注释 修改URL地址为本机地址
编译配置文件生效
[root@gitlab ~]# gitlab-ctl reconfigure
- restart service service[sidekiq]
Recipe: gitlab::gitlab-rails
* execute[clear the gitlab-rails cache] action run
- execute /opt/gitlab/bin/gitlab-rake cache:clear
Recipe: <Dynamically Defined Resource>
* service[nginx] action restart
- restart service service[nginx]
* service[grafana] action restart
- restart service service[grafana]
Running handlers:
Running handlers complete
重启服务
[root@gitlab ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 6658) 0s
ok: run: gitaly: (pid 6675) 0s
ok: run: gitlab-exporter: (pid 6694) 1s
ok: run: gitlab-workhorse: (pid 6696) 0s
ok: run: grafana: (pid 6719) 1s
ok: run: logrotate: (pid 6738) 0s
ok: run: nginx: (pid 6745) 1s
ok: run: node-exporter: (pid 6753) 0s
ok: run: postgres-exporter: (pid 6760) 0s
ok: run: postgresql: (pid 6770) 1s
ok: run: prometheus: (pid 6785) 0s
ok: run: redis: (pid 6801) 1s
ok: run: redis-exporter: (pid 6873) 0s
ok: run: sidekiq: (pid 6921) 1s
ok: run: unicorn: (pid 6932) 0s
0x3 git clone 项目到本地时提示输入git密码解决方案
#激活git用户
[root@gitlab ~]# sudo passwd -u -f git
#修改密码
passwd git
0x4 SSH-KEY 上传到GitLab服务器 免密登录
cat id_rsa.pub 复制
0x5 客户端测试
git clone git@192.168.1.18:root/1111.git