-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup-git-https.sh
More file actions
executable file
·76 lines (64 loc) · 1.91 KB
/
setup-git-https.sh
File metadata and controls
executable file
·76 lines (64 loc) · 1.91 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
#!/bin/bash
echo "🔧 Noti Git HTTPS Setup"
echo "======================="
echo ""
# Check if we're in the right directory
if [ ! -d "notes" ]; then
echo "❌ Error: Run this script from the note-system directory"
exit 1
fi
# Switch remote to HTTPS
echo "📝 Switching Git remote to HTTPS..."
cd notes
git remote set-url origin https://github.com/devjasha/Notes.git
echo "✅ Remote URL updated to: $(git remote get-url origin)"
cd ..
# Prompt for credentials
echo ""
echo "🔑 Git Credentials Setup"
echo "------------------------"
echo "Get a token from: https://github.com/settings/tokens"
echo ""
read -p "Enter your GitHub username [devjasha]: " username
username=${username:-devjasha}
read -sp "Enter your Personal Access Token: " token
echo ""
if [ -z "$token" ]; then
echo "❌ No token provided. Exiting."
exit 1
fi
# Create .env file
echo "📄 Creating .env file..."
cat > .env <<EOF
# Git credentials for Docker
GIT_USERNAME=$username
GIT_TOKEN=$token
EOF
echo "✅ .env file created"
# Update docker-compose.yml to use .env
echo "📝 Updating docker-compose.yml..."
if grep -q "GIT_USERNAME=\${GIT_USERNAME}" docker-compose.yml; then
echo "✅ docker-compose.yml already configured"
else
# Backup
cp docker-compose.yml docker-compose.yml.backup
# Add env vars (simple approach - manually edit if needed)
echo ""
echo "⚠️ Manually update docker-compose.yml environment section with:"
echo " - GIT_USERNAME=\${GIT_USERNAME}"
echo " - GIT_TOKEN=\${GIT_TOKEN}"
fi
echo ""
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo "1. Edit docker-compose.yml and uncomment the GIT_USERNAME and GIT_TOKEN lines"
echo " Or add:"
echo " - GIT_USERNAME=\${GIT_USERNAME}"
echo " - GIT_TOKEN=\${GIT_TOKEN}"
echo ""
echo "2. Restart Docker:"
echo " docker-compose down"
echo " docker-compose up -d"
echo ""
echo "3. Test by pushing from the web interface!"