diff --git a/scripts/git_autopush.sh b/scripts/git_autopush.sh new file mode 100755 index 0000000..4d76648 --- /dev/null +++ b/scripts/git_autopush.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# git_autopush.sh — ~/.openclaw 워크스페이스 일일 자동 커밋·push (LLM 미경유) +# 트리거: launchd ai.openclaw.git-autopush (매일 02:00 KST) +# 인증: HTTPS + credential.helper=store (~/.git-credentials), GUI 키체인 불필요 +export TZ=Asia/Seoul +export PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin + +REPO="$HOME/.openclaw" +cd "$REPO" || { echo "$(date '+%F %T') repo 없음: $REPO"; exit 1; } + +STAMP=$(date '+%F %T') + +# 변경 없으면 빈 커밋 방지하고 종료 +if [ -z "$(git status --porcelain)" ]; then + echo "$STAMP 변경 없음 — skip" + exit 0 +fi + +git add -A +git commit -m "auto: 일일 백업 $(date '+%F %H:%M') + +Co-Authored-By: Claude Opus 4.8 " || { echo "$STAMP commit 실패"; exit 1; } + +if git push origin main; then + echo "$STAMP push 완료 ($(git rev-parse --short HEAD))" +else + echo "$STAMP push 실패" + exit 1 +fi