diff --git a/.sync-gitea-cron.log b/.sync-gitea-cron.log new file mode 100644 index 00000000..cf9b4c46 --- /dev/null +++ b/.sync-gitea-cron.log @@ -0,0 +1,8 @@ +[INFO] 初始化 Git 仓库... +[WARNING] Git 仓库已存在 +[INFO] 远程仓库 URL 已更新 +[INFO] 远程仓库已存在: hao/websafe-kb +[WARNING] 未提供 GITEA_TOKEN;推送时将使用本机已有认证方式 +[SUCCESS] 初始化完成 +[INFO] 检查更改... +/Users/x/websafe/scripts/sync-gitea.sh: line 136: $1: unbound variable diff --git a/scripts/sync-gitea.sh b/scripts/sync-gitea.sh index 4d12b9ef..8f62b2ff 100755 --- a/scripts/sync-gitea.sh +++ b/scripts/sync-gitea.sh @@ -133,8 +133,9 @@ commit_changes() { local commit_msg="更新: ${changed_files} 个文件 - ${timestamp}" # 如果提供了自定义提交信息 - if [ -n "$1" ]; then - commit_msg="$1" + local custom_msg="${1:-}" + if [ -n "$custom_msg" ]; then + commit_msg="$custom_msg" fi git commit -m "$commit_msg"