1. 进入容器
docker exec -it jenkins /bin/bash
2. 在root下执行命令
ssh-keygen -t rsa
注意: 敲回车就好
3. 获取sshkey
cat .ssh/id_rsa.pub
4. 将添加到git仓库
5. 首次获取代码,最好先使用命令,不然可能在jenkins管理界面显示key无效
git clone {代码仓库地址}
来源:oschina
链接:https://my.oschina.net/qbj/blog/4255181