X-Git-Url: https://oss.titaniummirror.com/gitweb?p=git-utils.git;a=blobdiff_plain;f=git-push-public;fp=git-push-public;h=559f6091c353528bc94865d2f889a6174d674a16;hp=0000000000000000000000000000000000000000;hb=7b9e71a17877fc3fe94c4c924a891bea93bf5876;hpb=5294df37a0c3bbbc4c1fd0baf3a9335c3802b108 diff --git a/git-push-public b/git-push-public new file mode 100755 index 0000000..559f609 --- /dev/null +++ b/git-push-public @@ -0,0 +1,25 @@ +#!/bin/bash +# git-push-public +# +# Push changes from local git repositories marked as public, via the +# git-daemon-export-ok flag, to the public server. + +LOCALBASE=/var/lib/git +PUBLICBASE=/var/cache/git +PUBLICSERVER=oss.titaniummirror.com + +echo "Updating remote public repositories" +cd $LOCALBASE +for path in $(find . -name git-daemon-export-ok); do + repo="${path/\/git-daemon-export-ok/}" + repo="${repo/.\//}" + echo "Repository $repo" + if ! ssh $PUBLICSERVER test -d $PUBLICBASE/$repo ; then + # Repo does not exist on public server, so create it + echo "Creating repository $repo on remote" + ssh $PUBLICSERVER git --git-dir=$PUBLICBASE/$repo init --bare + ssh $PUBLICSERVER touch $PUBLICBASE/$repo/git-daemon-export-ok + scp $repo/description $PUBLICSERVER:$PUBLICBASE/$repo/ + fi + git --git-dir=$repo push --mirror $PUBLICSERVER:$PUBLICBASE/$repo +done