Add server-update.sh for force sync when CRLF causes git pull conflicts.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# 强制 Shell 脚本使用 LF,避免 Linux 上 $'\r': command not found
|
||||
*.sh text eol=lf
|
||||
server-update.sh text eol=lf
|
||||
deploy.sh text eol=lf
|
||||
|
||||
# 其他应在 Linux 服务器运行的文本文件
|
||||
|
||||
@@ -48,12 +48,16 @@
|
||||
> pm2 restart trading_studio
|
||||
> ```
|
||||
|
||||
> **git pull 报本地修改冲突?** 执行:
|
||||
> **git pull 报本地修改冲突?** 多半是 Windows CRLF 换行符幽灵改动(内容其实没变)。执行:
|
||||
> ```bash
|
||||
> git stash push -m "backup" -- config.py llm_service.py
|
||||
> git pull
|
||||
> bash server-update.sh
|
||||
> ```
|
||||
> 或手动:
|
||||
> ```bash
|
||||
> git fetch origin && git reset --hard origin/main
|
||||
> pm2 restart trading_studio
|
||||
> ```
|
||||
> 切勿 `git stash pop`,Ollama 地址请写在 `.env` 里。
|
||||
|
||||
### 0.2 首次一键部署
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# 服务器快速更新(强制与远端同步,忽略 CRLF 等幽灵改动)
|
||||
# 用法: bash server-update.sh
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
echo "[INFO] 拉取远端..."
|
||||
git fetch origin main
|
||||
echo "[INFO] 强制同步到 origin/main(本地 config.py 等改动将被覆盖,请用 .env 配置 Ollama)"
|
||||
git reset --hard origin/main
|
||||
echo "[INFO] 重启 PM2..."
|
||||
pm2 restart trading_studio
|
||||
pm2 status
|
||||
echo "[OK] 更新完成。Ollama 地址请编辑 .env(见 .env.example)"
|
||||
Reference in New Issue
Block a user