jenkins使用5----gi服务器搭建连接

♦安装git

♦服务器创建git用户

[root@localhost home]# id git
id: git:无此用户
[root@localhost home]# useradd git
[root@localhost home]# passwd git

 ♦服务器创建git仓库

[root@localhost home]# mkdir -p data/git/gittest.git
[root@localhost home]# git init --bare data/git/gittest.git
[root@localhost home]# cd data/git/
[root@localhost git]# chown -R git:git gittest.git/

♦可以创建项目(测试没做)

♦然后从linux git服务器上clone项目

[root@localhost gittest]# git clone ssh://git@192.168.150.163/data/git/gittest.git/

端口如果不是22

[root@localhost gittest]# git clone ssh://git@192.168.150.163:2994/data/git/gittest.git/

git@192.168.150.163's password:     git用户密码

♦jenkins调用git需要将jenkins的公钥传给/home/git/.ssh/authorized_keys文件里。将jenkins的私钥传到凭证里面

原文地址:https://www.cnblogs.com/charon2/p/10522256.html