-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-github.sh
More file actions
executable file
Β·135 lines (124 loc) Β· 4.15 KB
/
setup-github.sh
File metadata and controls
executable file
Β·135 lines (124 loc) Β· 4.15 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# KB1 Flash Tool - GitHub Repository Setup Script
# Repository: https://github.com/PocketMidi/KB1-flash
REPO_URL="https://github.com/PocketMidi/KB1-flash.git"
GITHUB_USER="PocketMidi"
echo "π KB1 Flash Tool - GitHub Setup"
echo "================================"
echo "Repository: $REPO_URL"
echo ""
# Check if git is initialized
if [ ! -d .git ]; then
echo "π Step 1: Initializing Git repository..."
git init
echo "β
Git initialized"
echo ""
else
echo "β
Git already initialized"
echo ""
fi
# Check if files are committed
if [ -z "$(git log 2>/dev/null)" ]; then
echo "π Step 2: Creating initial commit..."
git add .
git commit -m "Initial commit - KB1 Flash Tool v1.0.0"
echo "β
Initial commit created"
echo ""
else
echo "β
Repository already has commits"
# Check if there are uncommitted changes
if ! git diff-index --quiet HEAD --; then
echo "β οΈ You have uncommitted changes"
read -p "Commit changes now? (y/n): " COMMIT_NOW
if [ "$COMMIT_NOW" = "y" ]; then
git add .
read -p "Commit message (or press Enter for 'Update KB1 Flash Tool'): " COMMIT_MSG
COMMIT_MSG=${COMMIT_MSG:-"Update KB1 Flash Tool"}
git commit -m "$COMMIT_MSG"
echo "β
Changes committed"
fi
fi
echo ""
fi
# Ask for confirmation before pushing
echo "π Step 3: Connect to GitHub"
echo ""
echo "Make sure you've created the repository on GitHub:"
echo " π https://github.com/PocketMidi/KB1-flash"
echo ""
echo "If not created yet:"
echo " 1. Go to: https://github.com/new"
echo " 2. Name: KB1-flash"
echo " 3. Owner: PocketMidi"
echo " 4. Visibility: Public"
echo " 5. DO NOT initialize with README/license"
echo " 6. Click 'Create repository'"
echo ""
read -p "Repository created on GitHub? Press Enter to continue..."
echo ""
echo "π Step 4: Adding remote and pushing to GitHub..."
echo ""
# Check if remote already exists
if git remote | grep -q "origin"; then
CURRENT_URL=$(git remote get-url origin)
if [ "$CURRENT_URL" != "$REPO_URL" ]; then
echo "β οΈ Remote 'origin' exists with different URL: $CURRENT_URL"
echo " Updating to: $REPO_URL"
git remote set-url origin "$REPO_URL"
else
echo "β
Remote 'origin' already set correctly"
fi
else
echo "Adding remote 'origin'..."
git remote add origin "$REPO_URL"
fi
# Set main branch
git branch -M main
# Push to GitHub
echo ""
echo "Pushing to GitHub..."
if git push -u origin main; then
echo ""
echo "β
Code pushed to GitHub successfully!"
echo ""
else
echo ""
echo "β οΈ Push failed. This might be because:"
echo " 1. Repository doesn't exist on GitHub yet"
echo " 2. You need to authenticate (check credentials)"
echo " 3. Branch protection rules are enabled"
echo ""
read -p "Try force push? (y/n): " FORCE_PUSH
if [ "$FORCE_PUSH" = "y" ]; then
git push -u origin main --force
else
echo "Manual push: git push -u origin main"
exit 1
fi
fi
echo "π Setup Complete!"
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββββ"
echo "Next Steps:"
echo "ββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "1οΈβ£ Enable GitHub Pages:"
echo " https://github.com/PocketMidi/KB1-flash/settings/pages"
echo ""
echo " Under 'Build and deployment':"
echo " - Source: Select 'GitHub Actions'"
echo " - This auto-saves, no Save button needed"
echo ""
echo "2οΈβ£ Watch deployment:"
echo " https://github.com/PocketMidi/KB1-flash/actions"
echo ""
echo " Wait ~1-2 minutes for green checkmark β"
echo ""
echo "3οΈβ£ Visit your live site:"
echo " π https://PocketMidi.github.io/KB1-flash/"
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "π See GITHUB_SETUP.md for custom domain setup"
echo "π See DEPLOY.md for manual deployment steps"
echo ""