#!/bin/bash

# Block Pushes only (git-receive-pack)
# We check the Service name or the URI for "receive-pack"
if [[ "$QUERY_STRING" == *"service=git-receive-pack"* || "$REQUEST_URI" == *"/git-receive-pack"* ]]; then
    echo "Status: 403 Forbidden"
    echo "Content-type: text/plain"
    echo ""
    echo "Write access denied: This server is read-only."
    exit 0
fi

# Allow everything else (GETs and the "Upload" POSTs used for cloning)
exec /usr/lib/git-core/git-http-backend
