From e4383cf4b57e1133db6b41fb4a5ecec3ff57371b Mon Sep 17 00:00:00 2001 From: cc Date: Sun, 21 Jun 2026 21:28:41 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=AE=B0=E5=BD=95=20git=20=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E8=BF=9C=E7=A8=8B=E4=B8=8E=E6=8E=A8=E9=80=81=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=EF=BC=88gitea=20=E7=9B=B4=E6=8E=A8=E3=80=81GitHub=20?= =?UTF-8?q?=E9=9C=80=E6=89=8B=E5=8A=A8=20Token=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充行尾 CRLF/LF 提醒,避免行尾噪声混入功能提交。 Co-Authored-By: Claude Opus 4.8 --- docs/startpage-weather-location.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/startpage-weather-location.md b/docs/startpage-weather-location.md index e075c30..3e5c5c7 100644 --- a/docs/startpage-weather-location.md +++ b/docs/startpage-weather-location.md @@ -169,3 +169,27 @@ ssh root@8.130.143.54 "pkill RustServer; cd /opt/internet-project && \ 清空服务器 `static/` → 上传 `dist/*`。后端进程不用动(实时读磁盘静态文件)。 - **改了后端**(`Server/` 下任何代码):需在 WSL `cargo build --release` → 覆盖 `/opt/internet-project/RustServer` → 带环境变量重启(见上「部署:改了后端时」)。 + +## Git 远程与推送 + +仓库有两个远程,代码改完上线后两边都要同步: + +| 远程 | 地址 | 协议 / 认证 | 在 WSL 里能否直接推 | +|------|------|-------------|---------------------| +| `gitea` | `ssh://gitea@8.130.143.54:2222/cc/PersonalWebApplication.git` | SSH(已配密钥) | ✅ 可直接 `git push gitea main` | +| `origin` | `https://github.com/KarCharon/MyOwnWebPage.git` | HTTPS(需账号 / Token) | ⚠️ 非交互环境推不了,要手动 | + +- **gitea**:WSL 里 SSH 密钥已就绪,`git push gitea main` 直接成功。 +- **GitHub(origin)**:HTTPS 地址在自动化 / 非交互环境里没有凭据会报 + `could not read Username for 'https://github.com'`。手动推送时,密码要填 + **Personal Access Token**(不是登录密码)。若想长期免输入,可改用 SSH(前提是 + GitHub 配过本机公钥): + + ```bash + git remote set-url origin git@github.com:KarCharon/MyOwnWebPage.git + git push origin main + ``` + +> 行尾:仓库历史里部分文件曾从 Windows 带入 CRLF。在 WSL(LF)下编辑会让这些文件 +> 整片显示为「已改动」,其实只是行尾差异(`git diff --ignore-all-space` 为空)。 +> 提交前注意别把这类行尾噪声混进功能提交;要彻底消除可加 `.gitattributes`(`* text=auto eol=lf`)。