部署Jenkins参考https://www.jianshu.com/p/e61cdd69d82e
部署gitlab参考https://www.jianshu.com/p/4baf7de905e0
1、给gitlab配置Jenkins服务器的公钥
[root@jenkins ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiv7Wo67OuV16/Ciu9bUqiv09Oyo3f1ySfnwXgohGvurZzDJhRKf9mHW61kq4HeXwZJMJpTfG7E/s00Uu3Zn4al81vJO8myj+Mvad9Mfxph+eTlQgb3TFtGb97j5yNbH0mwuErSTiZZyzrWGaNZR5Usam1PwBPHPWeu8SSVBmSOxR/G6TjS3FHtjkwCYq0TPoIQbx5tCArjsqfzDBPbGZigQMbn4fWQ2BDAs/yrw6oJ2NiSXgerhQBzxtAEPF1QUOLp6ulTm3buuCz2vTzu7LqM7fncRG5du5oh8I+rrKWc0RAGLoWsvGYZrmflcXrRtTzv110KeA6XJAG9x8P2wB5 root@jenkins
2、在Jenkins上新建一个项目
[root@jenkins ~]# cat /root/.ssh/id_rsa
//查看Jenkins服务器的私钥然后去构建项目。自动拉取代码
在Jenkins服务器上认证
在这个目录下能找到自己拉取git的项目;证明项目成功完成
[root@jenkins ~]# ls /root/.jenkins/workspace/oneice
test1.txt test2.txt test.txt