How to setup automatic git repository (Bitbucket) updates with our development environment

How to setup automatic git repository (Bitbucket) updates with our development environment

1. clone with bitbucket manually .
clone https://username:password@bitbucket.org/xxxx/yyyyyy.git  mybitbucket_bkp
Note:mybitbucket_bkp is the folder which is updated with bitbucket directly.

2.Write a shell script and set a cron-job as given below (ex:testsync.sh) .
#!/bin/bash
#sync with bitbucket
# we get the update from bitbucket to mybitbucket_bkp
cd /mnt/www/mybitbucket_bkp/
git pull

# we use rsync to update our development folder (my_dev_store) with excluded files and with excluded folders
rsync -avz –exclude app/config/database.php –exclude app/routes.php –exclude app/storage /mnt/www/mybitbucket_bkp/ /mnt/www/my_dev_store/

#we do composer update if need
sudo composer dumpautoload

#end

3.set the cron job for every 5 minutes
*/5 * * * * cd /mnt/www/test_script/; ./testsync.sh

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s