-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_to_github.sh
More file actions
61 lines (50 loc) · 1.46 KB
/
upload_to_github.sh
File metadata and controls
61 lines (50 loc) · 1.46 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
#!/bin/bash
echo "GitHub上传脚本"
echo "================"
# 检查是否在正确的目录
if [ ! -f "src/main.py" ]; then
echo "错误:请在DataProcessing项目根目录运行此脚本"
exit 1
fi
echo "当前项目状态:"
git status
echo ""
echo "请按照以下步骤操作:"
echo ""
echo "1. 打开 https://github.com 并登录"
echo "2. 点击右上角的 '+' → 'New repository'"
echo "3. Repository name: DataProcessing"
echo "4. Description: 多模态数据处理项目"
echo "5. 选择 Public"
echo "6. 不要勾选任何复选框"
echo "7. 点击 'Create repository'"
echo ""
read -p "完成GitHub仓库创建后,请输入仓库URL (例如: https://github.com/18621098785/DataProcessing.git): " REPO_URL
if [ -z "$REPO_URL" ]; then
echo "错误:仓库URL不能为空"
exit 1
fi
echo ""
echo "正在连接到GitHub仓库..."
# 添加远程仓库
git remote add origin $REPO_URL
# 重命名分支为main
git branch -M main
# 推送到GitHub
echo "正在推送代码到GitHub..."
git push -u origin main
if [ $? -eq 0 ]; then
echo ""
echo "🎉 成功!项目已上传到GitHub"
echo "您现在可以在GitHub主页看到您的项目了!"
echo ""
echo "项目地址: ${REPO_URL%.git}"
else
echo ""
echo "❌ 推送失败,可能的原因:"
echo "1. 网络问题"
echo "2. 仓库URL错误"
echo "3. 需要身份验证"
echo ""
echo "请检查错误信息并参考 GITHUB_UPLOAD_GUIDE.md"
fi