Skip to content

Commit 00f2339

Browse files
author
54895y
committed
Update GitHub links and resolve merge conflicts
2 parents b8604c0 + 7f52a0f commit 00f2339

6 files changed

Lines changed: 628 additions & 0 deletions

File tree

QUICK_START.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 🚀 快速开始 - 3 分钟部署
2+
3+
## 第 1 分钟:初始化 Git
4+
5+
打开命令行,运行:
6+
7+
```bash
8+
cd "D:\我的世界\Minecraft代码\MatrixShop\matrixshop-docs"
9+
git init
10+
git config --global user.name "54895y"
11+
git config --global user.email "54895y@example.com"
12+
```
13+
14+
## 第 2 分钟:提交代码
15+
16+
```bash
17+
git add .
18+
git commit -m "Initial commit: MatrixShop documentation"
19+
```
20+
21+
## 第 3 分钟:推送到 GitHub
22+
23+
```bash
24+
# 先在 GitHub 创建仓库
25+
# 访问: https://github.com/new
26+
# 仓库名: 54895y.github.io
27+
28+
git remote add origin https://github.com/54895y/54895y.github.io.git
29+
git branch -M main
30+
git push -u origin main
31+
```
32+
33+
## 部署到 GitHub Pages
34+
35+
1. 访问 https://github.com/54895y/54895y.github.io/settings/pages
36+
2. Source 选择 **GitHub Actions**
37+
3. Branch 选择 **main**
38+
4. 点击 **Save**
39+
5. 等待 2-5 分钟
40+
6. 访问 https://54895y.github.io 查看网站
41+
42+
## 完成!🎉
43+
44+
你的文档网站已经部署成功!
45+
46+
---
47+
48+
## 自动部署
49+
50+
以后每次修改文档后,只需运行:
51+
52+
```bash
53+
git add .
54+
git commit -m "更新说明"
55+
git push origin main
56+
```
57+
58+
GitHub Actions 会自动部署!

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
# MatrixShop 文档网站
23

34
这是 MatrixShop 插件的官方文档网站,基于 Docusaurus 构建。
@@ -52,3 +53,6 @@ matrixshop-docs/
5253
├── sidebars.ts # 侧边栏配置
5354
└── package.json # 项目配置
5455
```
56+
=======
57+
# -54895y.github.io
58+
>>>>>>> 7f52a0fddbc3bc603e262a606d0b4ed07517bcbd

RESOLVE_CONFLICT.md

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
# 🚫 Git Push 冲突解决指南
2+
3+
## 错误信息
4+
5+
```
6+
To https://github.com/54895y/54895y.github.io.git
7+
! [rejected] main -> main (fetch first)
8+
error: failed to push some refs to 'https://github.com/54895y/54895y.github.io.git'
9+
hint: Updates were rejected because the remote contains work that you do not
10+
hint: have locally. This is usually caused by another repository pushing to
11+
hint: the same ref.
12+
```
13+
14+
## 原因
15+
16+
远程仓库有本地没有的提交,通常是:
17+
- GitHub 创建仓库时自动生成的 README
18+
- GitHub 创建仓库时自动生成的 .gitignore
19+
- 之前推送过的提交
20+
21+
---
22+
23+
## 解决方案
24+
25+
### 方案 1: 拉取远程更改并合并(推荐)
26+
27+
```bash
28+
git pull origin main --allow-unrelated-histories
29+
git push -u origin main
30+
```
31+
32+
**优点**: 保留远程和本地的所有更改
33+
**缺点**: 可能需要解决合并冲突
34+
35+
---
36+
37+
### 方案 2: 强制推送(如果远程仓库可以覆盖)
38+
39+
```bash
40+
git push -f origin main
41+
```
42+
43+
**优点**: 简单直接
44+
**缺点**: 会覆盖远程仓库的所有内容
45+
46+
**使用场景**:
47+
- 远程仓库是空的或只有 README
48+
- 你确定要覆盖远程内容
49+
50+
---
51+
52+
### 方案 3: 先合并再推送
53+
54+
```bash
55+
git fetch origin
56+
git merge origin/main
57+
git push -u origin main
58+
```
59+
60+
**优点**: 安全,可以查看远程更改
61+
**缺点**: 需要手动解决冲突
62+
63+
---
64+
65+
## 🛠️ 快速解决
66+
67+
### 方法 A: 使用脚本(推荐)
68+
69+
双击运行 `fix-push.bat` 脚本,它会自动尝试解决方案。
70+
71+
### 方法 B: 手动解决
72+
73+
#### 步骤 1: 拉取远程更改
74+
75+
```bash
76+
git pull origin main --allow-unrelated-histories
77+
```
78+
79+
#### 步骤 2: 如果有冲突,解决后提交
80+
81+
```bash
82+
git add .
83+
git commit -m "Merge remote changes"
84+
```
85+
86+
#### 步骤 3: 推送
87+
88+
```bash
89+
git push -u origin main
90+
```
91+
92+
---
93+
94+
## 如果远程仓库只有 README
95+
96+
如果远程仓库只有 README 文件,可以直接覆盖:
97+
98+
```bash
99+
# 1. 查看远程 README
100+
git pull origin main
101+
102+
# 2. 强制推送本地内容
103+
git push -f origin main
104+
```
105+
106+
或者:
107+
108+
```bash
109+
# 1. 删除本地 README
110+
git rm README.md
111+
112+
# 2. 提交删除
113+
git commit -m "Remove README"
114+
115+
# 3. 推送
116+
git push origin main
117+
118+
# 4. 重新添加所有文件
119+
git add .
120+
git commit -m "Add all files"
121+
git push -u origin main
122+
```
123+
124+
---
125+
126+
## 验证解决
127+
128+
推送成功后,运行:
129+
130+
```bash
131+
git status
132+
```
133+
134+
应该显示:
135+
136+
```
137+
On branch main
138+
Your branch is up to date with 'origin/main'.
139+
140+
nothing to commit, working tree clean
141+
```
142+
143+
---
144+
145+
## 常见问题
146+
147+
### Q1: 拉取时提示 "refusing to merge unrelated histories"
148+
149+
**A**: 使用 `--allow-unrelated-histories` 参数:
150+
151+
```bash
152+
git pull origin main --allow-unrelated-histories
153+
```
154+
155+
### Q2: 合并冲突怎么办?
156+
157+
**A**:
158+
1. 查看冲突文件
159+
2. 手动编辑解决冲突
160+
3. 标记为已解决: `git add <文件名>`
161+
4. 提交: `git commit -m "Resolve conflicts"`
162+
163+
### Q3: 强制推送后远程内容丢失了怎么办?
164+
165+
**A**:
166+
- 如果远程只有 README,可以重新创建
167+
- 如果有重要数据,需要从备份恢复
168+
- 下次先拉取再推送
169+
170+
---
171+
172+
## 最佳实践
173+
174+
### 推荐流程
175+
176+
```bash
177+
# 1. 创建仓库时不要生成 README
178+
# 2. 本地初始化 Git
179+
git init
180+
git add .
181+
git commit -m "Initial commit"
182+
183+
# 3. 添加远程仓库
184+
git remote add origin https://github.com/54895y/54895y.github.io.git
185+
186+
# 4. 推送
187+
git push -u origin main
188+
```
189+
190+
### 如果远程有内容
191+
192+
```bash
193+
# 1. 先拉取
194+
git pull origin main --allow-unrelated-histories
195+
196+
# 2. 解决冲突(如果有)
197+
198+
# 3. 推送
199+
git push -u origin main
200+
```
201+
202+
---
203+
204+
## 一键解决脚本使用
205+
206+
运行 `fix-push.bat`:
207+
208+
1. 自动检查当前状态
209+
2. 尝试拉取远程更改
210+
3. 如果失败,询问是否强制推送
211+
4. 完成后显示结果
212+
213+
---
214+
215+
## 成功标志
216+
217+
推送成功后,你会看到:
218+
219+
```
220+
Enumerating objects: 100, done.
221+
Counting objects: 100% (100/100), done.
222+
Delta compression using up to 8 threads
223+
Compressing objects: 100% (80/80), done.
224+
Writing objects: 100% (90/90), 1.50 MiB | 3.00 MiB/s, done.
225+
Total 90 (delta 20), reused 0 (delta 0), pack-reused 0
226+
remote: Resolving deltas: 100% (20/20), done.
227+
To https://github.com/54895y/54895y.github.io.git
228+
* [new branch] main -> main
229+
branch 'main' set up to track 'origin/main'.
230+
```
231+
232+
然后访问 https://github.com/54895y/54895y.github.io 查看上传的文件。

0 commit comments

Comments
 (0)