If you just create a mirror of the Git repository, then you can configure the cron job to run the following script:
#!/bin/bash USER=bitbucketuser ERROR_FILE=clone_update_err CLONES=/path/to/clones cd $CLONES if [ $# -ne 1 ]; then for DIR in *; do if [ -d $DIR ]; then ./update.sh $DIR 2> $ERROR_FILE if [ -s $ERROR_FILE ]; then echo $DIR >&2 cat -n $ERROR_FILE >&2 fi fi done else DIR=$1 echo $DIR cd $DIR if [ -a source ]; then cd source if [ -d .hg ]; then hg pull elif [ -d .git ]; then git pull elif [ -d .bzr ]; then bzr pull elif [ -d .svn ]; then svn up else echo "$DIR is not a known repository type." return 1 fi cd .. hg convert source hg URL=ssh:// hg@bitbucket.org /$USER/$DIR/ cd hg hg pull $URL hg push $URL
It is assumed that you have the SSH key installed. As you can see, this will reflect other VCSs. It assumes a directory structure as follows:
clones/ project1/ source/
Obviously, this is only one-way, but if you do all your work in Git, then it does not matter.
source share