-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_to_github.sh
More file actions
executable file
·60 lines (51 loc) · 1.66 KB
/
push_to_github.sh
File metadata and controls
executable file
·60 lines (51 loc) · 1.66 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
#!/bin/bash
# Push OpenVPN Server to GitHub
cd /home/lazou/openvpn-server
echo "🚀 Pushing to GitHub..."
echo ""
# Check Git config
if ! git config user.name &>/dev/null; then
echo "⚠️ Git user not configured. Using defaults..."
git config user.name "Mapbaya" 2>/dev/null || true
git config user.email "mapbaya@users.noreply.github.com" 2>/dev/null || true
fi
# Add all files
echo "📦 Adding files..."
git add .
# Check if there are changes
if git diff --staged --quiet; then
echo "No changes to commit"
else
echo "💾 Committing..."
git commit -m "Initial commit: OpenVPN server with network optimizations" 2>/dev/null || git commit -m "first commit"
fi
# Set branch to main
git branch -M main 2>/dev/null || true
# Add remote if not exists
if ! git remote get-url origin &>/dev/null; then
echo "🔗 Adding remote..."
git remote add origin https://github.com/Mapbaya/OpenVpn-Server.git
else
# Update remote URL if different
CURRENT_URL=$(git remote get-url origin)
if [ "$CURRENT_URL" != "https://github.com/Mapbaya/OpenVpn-Server.git" ]; then
echo "🔄 Updating remote URL..."
git remote set-url origin https://github.com/Mapbaya/OpenVpn-Server.git
fi
fi
# Push to GitHub
echo "⬆️ Pushing to GitHub..."
git push -u origin main
if [ $? -eq 0 ]; then
echo ""
echo "✅ Successfully pushed to GitHub!"
echo "🌐 Repository: https://github.com/Mapbaya/OpenVpn-Server"
else
echo ""
echo "❌ Push failed. Possible reasons:"
echo " - Authentication required (use GitHub token or SSH)"
echo " - Repository permissions"
echo ""
echo "Try:"
echo " git push -u origin main"
fi