-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_setup.sh
More file actions
executable file
·111 lines (90 loc) · 2.36 KB
/
github_setup.sh
File metadata and controls
executable file
·111 lines (90 loc) · 2.36 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
#!/bin/bash
# Script to set up GitHub repository connection
# Check if GitHub username is provided
if [ $# -lt 2 ]; then
echo "Usage: $0 <github_username> <repository_name>"
echo "Example: $0 johndoe chrome-extension-niche-hunter"
exit 1
fi
GITHUB_USERNAME="$1"
REPO_NAME="$2"
echo "Setting up Git repository for Chrome Extension Niche Hunter..."
echo "GitHub Username: $GITHUB_USERNAME"
echo "Repository Name: $REPO_NAME"
# Initialize git repository if not already initialized
if [ ! -d ".git" ]; then
echo "Initializing Git repository..."
git init
else
echo "Git repository already initialized."
fi
# Create .gitignore if it doesn't exist
if [ ! -f ".gitignore" ]; then
echo "Creating .gitignore file..."
cat > .gitignore << EOL
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# Environment variables and secrets
.env
*.env
# Distribution / packaging
dist/
build/
*.egg-info/
# Virtual environments
venv/
env/
ENV/
# IDE specific files
.idea/
.vscode/
*.swp
*.swo
# Streamlit specific
.streamlit/
# Data directories
data/scrapes/*
data/ideas/*
!data/scrapes/.gitkeep
!data/ideas/.gitkeep
# Logs
*.log
# Temporary files
.DS_Store
Thumbs.db
EOL
# Create .gitkeep files to preserve empty directories
mkdir -p data/scrapes data/ideas
touch data/scrapes/.gitkeep
touch data/ideas/.gitkeep
echo ".gitignore file created."
else
echo ".gitignore file already exists."
fi
# Show status before commit
echo "Current git status:"
git status
# Add all files to staging
echo "Adding files to Git staging area..."
git add .
# Commit the files
echo "Committing files to local repository..."
git commit -m "Initial commit of Chrome Extension Niche Hunter"
# Add GitHub repository as a remote
echo "Adding GitHub repository as a remote..."
git remote add origin "https://github.com/$GITHUB_USERNAME/$REPO_NAME.git"
# Push to GitHub
echo "Pushing to GitHub..."
echo "You may be prompted for your GitHub credentials."
git push -u origin main
# Check if push was successful
if [ $? -eq 0 ]; then
echo "Success! Your project is now connected to GitHub!"
echo "Repository URL: https://github.com/$GITHUB_USERNAME/$REPO_NAME"
else
echo "Push failed. Please check your GitHub credentials and repository settings."
echo "You might need to create a personal access token at https://github.com/settings/tokens"
echo "and use that instead of your password."
fi