一 通过httpd 方式克隆
验证的用户密码及为 gitlab 登录用户密码
[root@jenkins-client ~]# mkdir test [root@jenkins-client ~]# cd test/ [root@jenkins-client test]# git clone http://172.16.0.111/devops/ops-docs.git 正克隆到 'ops-docs'... Username for 'http://172.16.0.111': root Password for 'http://root@172.16.0.111': remote: Enumerating objects: 13, done. remote: Counting objects: 100% (13/13), done. remote: Compressing objects: 100% (12/12), done. remote: Total 13 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (13/13), done. [root@jenkins-client test]# ls ops-docs
二 通过SSH方式
2.1 生成私钥
[root@centos7 ~]# ssh-keygen -t rsa -C "98stack soclond@sina.com"
[root@centos7 .ssh]# pwd /root/.ssh [root@centos7 .ssh]# ls id_rsa id_rsa.pub [root@centos7 .ssh]# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJNGSceEF6wCDCG9zBJnvmBcSO+hx9Kx7uGB0EfqSZA8cNN8QL76rFiYrW8btutCTgRFnMAo6LNrkxoH4IA9Hk/q2aaeyWqjZDtWOMFV1v7/QM7Fg5SLaAXNDZS9CAYMs+KlWMP7xbaqtKF0DlP4lxfSiHD5BU35e6ihCXRcxBcswsKtz0638S6vNpMDZDJodIMZ79ksUyIfagtH8c3/YtVPDBoRfO5emeBPWwdYu0Ni87QjYfVZlh6ye+JmFwcTcsRsPgkzBayKkyu9SfJVb2eYTSXgkMnrkSUOd23I6tgoETePw98eTPHTZbXWO5hcG83NOveeOMetW8kZfDqazr YanShicheng soclond@sina.com
2.1 GitLab 添加秘钥
管理员用户 -->> Settings -->> SSH Key --> 黏贴 id_rsa.pub 内容
客户端克隆测试
修改ssh端口克隆方法
[root@centos7 ssh]# git clone ssh://git@192.168.10.10:23/test-devops/LinuxArchitect.git
默认端口克隆方法
git clone git@192.168.10.10:test-devops/LinuxArchitect.git