一、下载插件Git Parameter (更加省事)
在配置中branch和tag用的比较多
注意:Credential 可以添加密码,jenkins如果在root用户下载的请改 /etc/sysconfig/jenkins 为root否则会报错;或者新建普通用户XXXX在修改
然后重启即可: service jenkins restart
二、配置好之后点击工程构建:
test分支为自己创建
[root@xiaoyuer test]# cd /root/test/app
[root@xiaoyuer app]# git branch test
[root@xiaoyuer app]# git branch
* master
test
[root@xiaoyuer app]# git checkout test
Already on 'test'
[root@xiaoyuer app]# git branch
master
* test
[root@xiaoyuer app]# touch a.html
[root@xiaoyuer app]# git add .
[root@xiaoyuer app]# git commit -m '1'
[test aaed40b] 1
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a.html
[root@xiaoyuer app]# git remote -v
origin git@xx:/home/git/repos/app.git (fetch)
origin git@xx:/home/git/repos/app.git (push)
[root@xiaoyuer app]# git push origin test
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 262 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@47.75.44.121:/home/git/repos/app.git
* [new branch] test -> test
[root@xiaoyuer app]# ls
a.html index.html