-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-github.sh
More file actions
executable file
·86 lines (73 loc) · 2.38 KB
/
setup-github.sh
File metadata and controls
executable file
·86 lines (73 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# TrailOpt - GitHub Setup Script
# This script helps you push your project to GitHub
echo "🚀 TrailOpt - GitHub Setup"
echo "=========================="
echo ""
# Check if git is initialized
if [ ! -d ".git" ]; then
echo "❌ Git not initialized. Run 'git init' first."
exit 1
fi
# Get GitHub username
read -p "Enter your GitHub username: " GITHUB_USERNAME
# Get repository name
read -p "Enter repository name (default: trailopt): " REPO_NAME
REPO_NAME=${REPO_NAME:-trailopt}
# Check if remote already exists
if git remote get-url origin &> /dev/null; then
echo "⚠️ Remote 'origin' already exists."
read -p "Do you want to update it? (y/n): " UPDATE_REMOTE
if [ "$UPDATE_REMOTE" = "y" ]; then
git remote set-url origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
fi
else
git remote add origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
fi
# Check current branch
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "📝 Renaming branch to 'main'..."
git branch -M main
fi
# Stage all files
echo "📦 Staging files..."
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "✅ No changes to commit."
else
echo "💾 Creating initial commit..."
git commit -m "Initial commit: TrailOpt - Intelligent Trip Planning & Optimization"
fi
# Push to GitHub
echo ""
echo "📤 Ready to push to GitHub!"
echo "Repository URL: https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
echo ""
read -p "Do you want to push now? (y/n): " PUSH_NOW
if [ "$PUSH_NOW" = "y" ]; then
echo "🚀 Pushing to GitHub..."
git push -u origin main
if [ $? -eq 0 ]; then
echo ""
echo "✅ Successfully pushed to GitHub!"
echo "🌐 View your repository at: https://github.com/$GITHUB_USERNAME/$REPO_NAME"
echo ""
echo "Next steps:"
echo "1. Go to https://vercel.com"
echo "2. Import your GitHub repository"
echo "3. Add environment variables (see DEPLOYMENT.md)"
echo "4. Deploy!"
else
echo ""
echo "❌ Push failed. Make sure:"
echo " - The repository exists on GitHub"
echo " - You have push access"
echo " - You're authenticated with GitHub"
fi
else
echo ""
echo "📝 To push manually, run:"
echo " git push -u origin main"
fi