目录结构:

 所以要自行下一个PLINK.exe放到同目录下。

@echo off
chcp 65001

:: 配置远程服务器地址和用户名
set server=xxxxxx
set username=xxxxxx
:: SSH 密码
set password=xxxxxx

:: 配置远程服务器 git 仓库的路径
set repo_path=/home/xxxxx/Desktop/net/

:: 提示输入 Git commit 消息
set /p commit_message=输入Git commit的内容 (回车默认使用当前时间):

:: 设置默认 Git commit 消息
if "%commit_message%"=="" (
  set commit_message=%date%
)

:: 连接到远程服务器并执行 git commit 操作
plink.exe -ssh %username%@%server% -pw %password% "cd %repo_path% && git prune && git add . && git commit -m '%commit_message%' && git push"

:: 输出提示信息
echo Git commit completed.

pause

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐