Files
magistr/.agent/skills/git-push/scripts/push_changes.sh
2026-02-18 21:56:57 +00:00

31 lines
1020 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# --- НАСТРОЙКИ (Проверь, чтобы совпадали с check_and_pull.sh) ---
SERVER="root@192.168.1.87"
REMOTE_PATH="/root/magistr/program"
# -------------------------------------------------------------
COMMIT_MSG="$1"
# Проверка: если сообщение пустое, ругаемся
if [ -z "$COMMIT_MSG" ]; then
echo "❌ Error: Commit message is required."
echo "Usage: ./push_changes.sh \"feat: description\""
exit 1
fi
echo "🚀 Starting Push Sequence to $SERVER..."
# Выполняем цепочку команд на сервере одной строкой
ssh -o BatchMode=yes "$SERVER" "export LANG=C.UTF-8 && cd $REMOTE_PATH && \
git add . && \
git commit -m \"$COMMIT_MSG\" && \
git push origin main"
# Проверяем код возврата последней команды
if [ $? -eq 0 ]; then
echo "✅ Success! Changes pushed to remote."
else
echo "❌ Failed to push. Check the output above for errors."
exit 1
fi