Reputation: 1515
I have 5 developers pointing to local git server.
What i want is if someone push to local git server then it should automatically push that changes to remote repository (eg. bitbucket) including any changes into any branch.
Just like identical copy of my local git server.
Q: Can i do using git hooks or any third party tools like Jenkins? (if yes then how)
Upvotes: 0
Views: 73
Reputation: 2342
Hi and Happy New Year!
You have already stated it in the question: you need a git hook. More precisely, post-receive hook.
In your bare repository there should be hooks/
directory and you should put your post-receive
script there.
In the most simple scenario you just run git push --all my_upstream_repo
in this script. You should have upstream repo already defined via git remote
.
PS. Using Jenkins would be an overkill; also, you'd need to inform Jenkins that some changes arrived at your local repository, so it's not buying you anything - you need a hook anyway. You can simply run another push in your hook instead of using any 3rd party tool which would need to be notified anyway.
Upvotes: 1