From 1a45beae513d1648bbc6af6e88e3e5001892f7d5 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Mon, 14 Apr 2025 13:48:19 +0800 Subject: [PATCH] no message --- app/Http/Controllers/CronController.php | 6 +++--- github/push.sh | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/CronController.php b/app/Http/Controllers/CronController.php index 3ee5ef8..a5fdb07 100755 --- a/app/Http/Controllers/CronController.php +++ b/app/Http/Controllers/CronController.php @@ -84,9 +84,9 @@ class CronController echo "Output from init.sh:\n$output\n"; - $output = shell_exec("git config --global --add safe.directory $sUserProjectDir 2>&1"); - - echo "
Output from --add safa.directory:\n$output\n"; +// $output = shell_exec("git config --global --add safe.directory $sUserProjectDir 2>&1"); +// +// echo "
Output from --add safa.directory:\n$output\n"; } // 写入内容 diff --git a/github/push.sh b/github/push.sh index 131023f..116d096 100755 --- a/github/push.sh +++ b/github/push.sh @@ -1,10 +1,22 @@ #!/bin/bash -cd $1 +# 检查是否提供了目录参数 +if [ -z "$1" ]; then + echo "请提供要操作的目录." + exit 1 +fi +# 进入指定目录 +cd "$1" || { echo "无法进入目录 $1"; exit 1; } + +# 添加安全目录 +git config --global --add safe.directory "$1" + +# 添加所有更改 git add . +# 提交更改,使用当前日期作为提交信息 git commit -m "$(date)" -git push origin main # 确保将 'main' 替换为你的默认分支名称 - +# 推送到远程仓库,确保将 'main' 替换为你的默认分支名称 +git push origin main # 或者使用你的默认分支名称