-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-git.sh
More file actions
executable file
·122 lines (110 loc) · 3.81 KB
/
Copy pathsetup-git.sh
File metadata and controls
executable file
·122 lines (110 loc) · 3.81 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
#!/bin/bash
set -e
REPO_NAME="cs4vwb"
REPO_DESCRIPTION="Claude Science custom app for Verily Workbench"
echo "=========================================="
echo "Setting up Git repository for $REPO_NAME"
echo "=========================================="
echo
# Check if we're already in a git repo
if [ -d .git ]; then
echo "Git repository already initialized."
read -p "Do you want to reinitialize? This will remove existing git history. (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf .git
echo "Removed existing .git directory"
else
echo "Keeping existing git repository. Exiting."
exit 0
fi
fi
# Initialize git repository
echo "Initializing git repository..."
git init
git add .
git commit -m "Initial commit: Claude Science custom app for Verily Workbench"
echo "✓ Git repository initialized and files committed"
echo
# Check if GitHub CLI is available
if command -v gh &> /dev/null; then
echo "GitHub CLI (gh) detected!"
# Check if authenticated
if gh auth status &> /dev/null; then
echo "You are authenticated with GitHub."
echo
read -p "Do you want to create the repository on GitHub now? (Y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
# Ask for public or private
echo
echo "Repository visibility:"
echo " 1) Public"
echo " 2) Private"
read -p "Choose (1 or 2, default: 2): " -n 1 -r VISIBILITY
echo
VISIBILITY_FLAG="--private"
if [[ $VISIBILITY == "1" ]]; then
VISIBILITY_FLAG="--public"
fi
# Create the repository
echo "Creating GitHub repository..."
gh repo create "$REPO_NAME" $VISIBILITY_FLAG --description "$REPO_DESCRIPTION" --source=. --remote=origin
echo
echo "✓ Repository created on GitHub"
# Push to GitHub
echo "Pushing to GitHub..."
git push -u origin main || git push -u origin master
echo
echo "=========================================="
echo "✓ SUCCESS!"
echo "=========================================="
echo
echo "Your repository is now available at:"
gh repo view --web --json url -q .url || echo "https://github.com/$(gh api user -q .login)/$REPO_NAME"
echo
echo "Next steps:"
echo " 1. Go to your Verily Workbench workspace"
echo " 2. Create a new Custom app"
echo " 3. Use the repository URL above"
echo
exit 0
fi
else
echo "GitHub CLI is installed but not authenticated."
echo "Run 'gh auth login' to authenticate, then run this script again."
echo
fi
else
echo "GitHub CLI (gh) not found."
echo "You can install it from: https://cli.github.com/"
echo
fi
# Manual setup instructions
echo "=========================================="
echo "Manual Setup Required"
echo "=========================================="
echo
echo "Please complete these steps:"
echo
echo "1. Go to GitHub and create a new repository:"
echo " https://github.com/new"
echo
echo "2. Repository name: $REPO_NAME"
echo " Description: $REPO_DESCRIPTION"
echo " Choose Public or Private"
echo " DO NOT initialize with README, .gitignore, or license"
echo
echo "3. After creating the repository, run these commands:"
echo
echo " git remote add origin https://github.com/YOUR_USERNAME/$REPO_NAME.git"
echo " git branch -M main"
echo " git push -u origin main"
echo
echo " (Replace YOUR_USERNAME with your GitHub username)"
echo
echo "=========================================="
echo
echo "Alternatively, install GitHub CLI for automatic setup:"
echo " https://cli.github.com/"
echo