第一步:
本地配置好git
第二步:
github远程仓库
点击右上角settings
进入二级页面后,选择左侧靠下 导航栏
进入三级页面后,选择左侧 导航栏
选择右上角
创建token
创建完毕后,获得一个token(记下来,等下要用到)
再去到你要操作的远程仓库,添加一个 webhook
这个PayloadURL填的就是http://XXX(你的服务器,填localhost 电脑切啥weifi都可用):端口号8080/github-webhook(照抄),其他的照抄
到这里 远程仓库 配置操作完毕
第二步:Jenkins配置
下载插件 GitHub Integration Plugin ,安装完后,重启jenkins
下载不了 就手动下载 直接安装Github Plugin, jenkins会自动帮你解决其他插件的依赖,直接安装该插件Jenkins会自动帮你安装plain-credentials 、git 、 credentials 、 github-api
配置Github 服务器
系统管理—>系统设置—>GitHub --> Add GitHub Sever
API URL 输入 https://api.github.com ,点击Add添加信息
Kind选择Secret Text
在创建的项目中的配置
构建触发器,构建环境 .(这2个不配置也没关系)
保存,点击构建,成功。完毕
完全参考这个大神的教程,非常感谢:https://www.cnblogs.com/lixuan1998/p/7154629.html 看这个成功了