#!/bin/bash log() { echo "$(date +'%Y-%m-%d %H:%M:%S') $1" } while true do log "Pushing git repository..." git push if [ $? -eq 0 ]; then log "Git push succeeded." break else log "Git push failed, retrying in 5 seconds." fi sleep 5 done