AutoPullRepo – a Bitbucket project

AutoPullRepo - a Bitbucket projectI’m a user and please don’t judge me for that. There are a lot of different opinions about Bitbucket vs. GitHub, but mine is the only one that matters to me since I’m extremely satisfied with the features and the use of Bitbucket. Why would I switch to any other source control service? Now that we cleared that out, let’s talk about this post’s subject. :)


The problem:

Actualy two of them. I have a hosting account in Slovenia, they block all foreign IP’s to connect to FTP, so It’s pain in the but to make some changes on the script there. My other problem (while working on WhoAPI); if you have let’s say 20 hosting accounts all over the world and you need to update the same script that’s on all of them, how would you do it? (no control of the server modules, so no automatic deployment)

The research:

I found no scripts that can solve these problems. I’m sure that they exists, but I lost two (if not more) hours trying to find a finished and a working one.

The solution:

I made a script (one file) that you upload to your server, change two lines of code, set the Bitbucket settings to ping the script as soon as you make the change to your files on your repository (30sec. job) and you’re done! What this script does is it download’s your script from the Bitbucket repository and extracts it, so you have the latest version of your script always live.

No FTP, no drag&dropping files or scp-ing to the server directly. Out of the box solution for easy automatic script deployment. And yes, It’s in PHP :/ I would like to write the same thing in Python, and Node.js version would be cool as well.

Check it out here:


  1. I tried this and got so close, but I get an error on line 38:
    [11-Apr-2012 22:09:51] PHP Parse error: syntax error, unexpected T_STRING in /home/nathan/public_html/area51/staging/columbia/pull-repo.php on line 38

  2. Maybe $repofile failed to get the data from your repo, is it a public one? It’s working fine on my end :/ Btw. thanks for trying it out! :)

Leave a Reply

Your email address will not be published. Required fields are marked *