Make Jenkins tracking git updates
at jenkins server:
@jenkins $ mkdir /var/git/project.git
@jenkins $ cd /var/git/project.git
@jenkins $ git init --bare --shared
at origin:
@origin $ cd /var/git/project.git
@origin $ cp hooks/post-receive.sample hooks/post-receive
@origin $ vi hooks/post-receive
#!/bin/sh
#####
# hooks/post-receive
#####
MIRROR_HOST='jenkins@jenkins'
REPO_NAME=`pwd | perl -e '$t=<stdin>;$t=~ s!^.*/!!;print $t'`
git push --mirror ${MIRROR_HOST}:/var/git/${REPO_NAME}
Written by p-baleine
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jenkins
Authors
julianchurchill
43.98K
denver
12.36K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#