-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_setup.sh
More file actions
executable file
·68 lines (58 loc) · 2.23 KB
/
Copy pathgit_setup.sh
File metadata and controls
executable file
·68 lines (58 loc) · 2.23 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
#!/bin/bash
# git_setup.sh - Script to set up a Git repository and push to GitHub
echo "====================================================="
echo " Setting up Git repository for AI Avatar Video"
echo "====================================================="
# Check if Git is installed
if ! command -v git &> /dev/null; then
echo "Git is not installed. Installing Git..."
sudo apt-get update
sudo apt-get install -y git
fi
# Initialize Git repository if not already done
if [ ! -d ".git" ]; then
echo "Initializing Git repository..."
git init
else
echo "Git repository already initialized."
fi
# Add all files
echo "Adding files to Git..."
git add .
# Update README with GitHub repository information
sed -i "s|yourusername|$username|g" README.md
# Commit changes
echo "Committing changes..."
git commit -m "Initial commit of AI Avatar Video application"
# Ask for GitHub username and repository name
read -p "Enter your GitHub username: " username
read -p "Enter the name for your new repository (e.g., ai-avatar-video): " reponame
# Create repository on GitHub using GitHub CLI if available, otherwise provide instructions
if command -v gh &> /dev/null; then
echo "Creating repository on GitHub..."
gh auth login
gh repo create "$reponame" --public --source=. --remote=origin --push
else
echo "GitHub CLI not found. Please create a repository manually on GitHub."
echo "Once created, run the following commands:"
echo ""
echo "git remote add origin https://github.com/$username/$reponame.git"
echo "git branch -M main"
echo "git push -u origin main"
echo ""
# Ask if repository was created manually
read -p "Have you created the repository on GitHub? (y/n): " created
if [ "$created" = "y" ]; then
echo "Adding remote..."
git remote add origin "https://github.com/$username/$reponame.git"
echo "Setting main branch..."
git branch -M main
echo "Pushing to GitHub..."
git push -u origin main
fi
fi
echo ""
echo "====================================================="
echo "Git repository setup complete!"
echo "Your code is now on GitHub at: https://github.com/$username/$reponame"
echo "====================================================="