no message

This commit is contained in:
hellcat 2025-04-14 13:53:16 +08:00
parent 1a45beae51
commit a634c129d2
2 changed files with 21 additions and 18 deletions

View File

@ -1,13 +1,28 @@
#!/bin/bash
cd $1
# 检查是否提供了目录和远程仓库地址参数
if [ -z "$1" ] || [ -z "$2" ]; then
echo "请提供要操作的目录和远程仓库地址."
exit 1
fi
# 进入指定目录
cd "$1" || { echo "无法进入目录 $1"; exit 1; }
# 添加安全目录
git config --global --add safe.directory "$1"
# 初始化 Git 仓库
git init
# 提交第一次更改
git commit -m "first commit"
# 创建并切换到 main 分支
git branch -M main
git remote add origin $2
# 添加远程仓库
git remote add origin "$2"
git push -u origin main
# 推送到远程仓库
# git push -u origin main

View File

@ -1,22 +1,10 @@
#!/bin/bash
# 检查是否提供了目录参数
if [ -z "$1" ]; then
echo "请提供要操作的目录."
exit 1
fi
cd $1
# 进入指定目录
cd "$1" || { echo "无法进入目录 $1"; exit 1; }
# 添加安全目录
git config --global --add safe.directory "$1"
# 添加所有更改
git add .
# 提交更改,使用当前日期作为提交信息
git commit -m "$(date)"
# 推送到远程仓库,确保将 'main' 替换为你的默认分支名称
git push origin main # 或者使用你的默认分支名称
git push origin main # 确保将 'main' 替换为你的默认分支名称