chore: Add push-all.sh script for multi-remote sync
- Push to Gitea, GitHub, and GitLab in sequence - Shows status for each remote - Supports optional commit message argument - Colored output for clarity
This commit is contained in:
69
push-all.sh
Executable file
69
push-all.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# push-all.sh - Push TrueRecall v2 to all remotes
|
||||
#
|
||||
# Usage: ./push-all.sh [commit-message]
|
||||
# If commit-message provided, will commit first
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
REPO_DIR="/root/.openclaw/workspace/.main_projects/true-recall-v2"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo "=========================================="
|
||||
echo "TrueRecall v2 - Push to All Remotes"
|
||||
echo "=========================================="
|
||||
|
||||
# Optional: commit if message provided
|
||||
if [ -n "$1" ]; then
|
||||
echo -e "${YELLOW}Committing changes...${NC}"
|
||||
git add -A
|
||||
git commit -m "$1" || echo "Nothing to commit"
|
||||
fi
|
||||
|
||||
# Check for uncommitted changes
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
echo -e "${YELLOW}Warning: You have uncommitted changes${NC}"
|
||||
echo "Run: git add -A && git commit -m 'your message'"
|
||||
echo "Or: ./push-all.sh 'your commit message'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Push to each remote
|
||||
remotes=("gitea" "github" "gitlab")
|
||||
failed=()
|
||||
|
||||
for remote in "${remotes[@]}"; do
|
||||
echo ""
|
||||
echo -e "${YELLOW}Pushing to $remote...${NC}"
|
||||
|
||||
if git push "$remote" main; then
|
||||
echo -e "${GREEN}✓ $remote pushed successfully${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ $remote push failed${NC}"
|
||||
failed+=("$remote")
|
||||
fi
|
||||
done
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
if [ ${#failed[@]} -eq 0 ]; then
|
||||
echo -e "${GREEN}All remotes pushed successfully!${NC}"
|
||||
else
|
||||
echo -e "${RED}Failed to push to: ${failed[*]}${NC}"
|
||||
echo "You may need to authenticate or fix network issues."
|
||||
fi
|
||||
echo "=========================================="
|
||||
|
||||
# Show current remotes
|
||||
echo ""
|
||||
echo "Current remotes:"
|
||||
git remote -v
|
||||
Reference in New Issue
Block a user