-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-github.sh
More file actions
46 lines (35 loc) · 1.19 KB
/
setup-github.sh
File metadata and controls
46 lines (35 loc) · 1.19 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
#!/bin/bash
# 颜色定义
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # 无颜色
echo -e "${GREEN}=== 初始化Git仓库并部署到GitHub ===${NC}\n"
# 检查git是否安装
if ! command -v git &> /dev/null; then
echo -e "${YELLOW}git未安装,请先安装git${NC}"
exit 1
fi
# 初始化git仓库
echo -e "${BLUE}正在初始化Git仓库...${NC}"
git init
# 添加所有文件
echo -e "\n${BLUE}添加文件到暂存区...${NC}"
git add .
# 初始提交
echo -e "\n${BLUE}创建初始提交...${NC}"
git commit -m "Initial commit"
# 添加远程仓库
echo -e "\n${BLUE}添加GitHub远程仓库...${NC}"
git remote add origin https://github.com/git2968/SCHEDULE-IMPORT.git
# 创建main分支并推送
echo -e "\n${BLUE}创建main分支...${NC}"
git branch -M main
echo -e "\n${YELLOW}即将推送到GitHub...${NC}"
echo -e "可能需要输入GitHub凭证\n"
# 推送到GitHub
echo -e "${BLUE}推送代码到GitHub...${NC}"
git push -u origin main
echo -e "\n${GREEN}完成!${NC}"
echo -e "仓库已推送到: ${BLUE}https://github.com/git2968/SCHEDULE-IMPORT${NC}"
echo -e "GitHub Pages将在几分钟后可用: ${BLUE}https://git2968.github.io/SCHEDULE-IMPORT/${NC}"