Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a BitBucket git commit hook?

I just ported over a repo from GitHub to BitBucket. Although it does many of necessities, I'm finding it surprisingly difficult to find documentation for creating a git commit hook.

Originally I had a ruby app on a CentOS server that was triggered by a GitHub hook. Does anyone know how to achieve the same in the BitBucket environment?

Thanks!

Edit: here's what the ruby app simply looks like if it helps:

post '/' do
  `rm -rf repofolder`
  `git clone https://[email protected]/user/repo.git`
  `sh fast_deploy.sh`
end
like image 941
crockpotveggies Avatar asked Sep 06 '25 07:09

crockpotveggies


1 Answers

I was able to find a solution. Although John Percival's answer is right, no current support for Ruby, the notification mechanism works.

The code for the Ruby app is in the question. Notice how it looks for a post via post '/' do. I was able to find support to send a POST to a URL in this neat find here: http://read-the-docs.readthedocs.org/en/latest/webhooks.html

Given that info, I was able to create a POST hook in BitBucket via:

  1. Go to repo "admin" tab
  2. Select "services"
  3. Create a POST service to a special port on my URL http://server.com:4567/
like image 130
crockpotveggies Avatar answered Sep 09 '25 02:09

crockpotveggies