26 lines
526 B
Bash
Executable File
26 lines
526 B
Bash
Executable File
#!/bin/bash
|
|
|
|
REPO_DIR="/home/cxh/sweeper_truck_ros"
|
|
|
|
cd "$REPO_DIR" || { echo "目录不存在: $REPO_DIR"; exit 1; }
|
|
|
|
# 配置用户名和邮箱(如果没配置)
|
|
git config user.name "cxh"
|
|
git config user.email "zxwl@56.com"
|
|
|
|
# 添加所有改动
|
|
git add .
|
|
|
|
# 自动提交,提交信息用当前时间
|
|
COMMIT_MSG="Auto commit on $(date '+%Y-%m-%d %H:%M:%S')"
|
|
git commit -m "$COMMIT_MSG"
|
|
|
|
# 推送到远程 main 分支
|
|
git push origin main
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "推送成功!"
|
|
else
|
|
echo "推送失败!"
|
|
fi
|