Compare commits

...

2 Commits

Author SHA1 Message Date
whm
826617d737 fix: ensure .sh scripts are LF in repo, add README note for bash\\r
Made-with: Cursor
2026-03-17 01:49:29 +08:00
whm
a0df3a8a41 fix: use LF for .sh scripts (.gitattributes) to fix bash\r on Linux
Made-with: Cursor
2026-03-17 01:45:52 +08:00
4 changed files with 10 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# 强制 shell 脚本使用 LF避免在 Linux 上出现 bash\r 错误
*.sh text eol=lf

View File

@@ -53,6 +53,12 @@ npm run dev
chmod +x pull-and-restart.sh restart.sh
```
若执行脚本报错 `bash\r: No such file or directory`(行尾为 Windows 的 CRLF在项目根目录执行一次
```bash
sed -i 's/\r$//' pull-and-restart.sh restart.sh
```
再执行 `chmod +x pull-and-restart.sh restart.sh` 后重试。
- **拉取代码并重启**`cd ~/project/yh_web && ./pull-and-restart.sh`
- **仅重启服务**`cd ~/project/yh_web && ./restart.sh`
- 对外域名https://yuheng.yuxindazhineng.com

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# 拉取代码并重启项目(线上项目根目录:/home/yxd/project/yh_web
# 行尾LF.gitattributes
# 用法cd /home/yxd/project/yh_web && ./pull-and-restart.sh
# 或指定目录PROJECT_ROOT=/home/yxd/project/yh_web ./pull-and-restart.sh
set -e

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# 仅重启项目(不拉代码),适用于配置/环境变更后重启
# 行尾LF.gitattributes
# 用法cd /home/yxd/project/yh_web && ./restart.sh
# 或PROJECT_ROOT=/home/yxd/project/yh_web ./restart.sh
set -e