diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..fab05db6069cb3abed407627165e7b38b539328a --- /dev/null +++ b/README.en.md @@ -0,0 +1,77 @@ +# README + +## Project Overview + +This project is a set of Git repository synchronization tools, including scripts for synchronizing local folders to a remote Git repository. + +## File Descriptions + +### 1.py + +Main synchronization module, providing the following functions: + +- **build_auth_url**: Build a Git URL with authentication information +- **run_git**: Execute Git commands +- **clone_repo**: Clone a remote repository to the local machine +- **get_latest_commit_time**: Get the latest commit time of the repository +- **get_local_folder_latest_mtime**: Get the latest modification time of the local folder +- **clear_folder**: Clear the contents of a folder +- **copy_folder_contents**: Copy contents of a folder +- **commit_and_push**: Commit and push changes +- **sync_mode1/sync_mode2/sync_mode3**: Three different synchronization modes +- **main**: Main entry point function + +### cmd1.py + +Command execution utility module, providing the following functions: + +- **run_command_and_save_log**: Run a command and save the log +- **clear_screen**: Clear the screen display +- **main**: Main entry point function + +### start.sh + +Environment configuration script used to set Git username and password environment variables: + +```bash +export GIT_USERNAME +export GIT_PASSWORD +``` + +### last.log + +Log file recording command execution results. + +## Usage + +### Synchronization Modes + +The project supports three synchronization modes: + +1. **sync_mode1**: Basic synchronization mode +2. **sync_mode2**: Synchronization mode with cleanup +3. **sync_mode3**: Incremental synchronization mode + +### Execution Steps + +1. Configure Git authentication credentials (via environment variables): + ```bash + export GIT_USERNAME="your_username" + export GIT_PASSWORD="your_password" + ``` + +2. Run the synchronization script: + ```bash + python 1.py + ``` + +3. Or run the command utility: + ```bash + python cmd1.py + ``` + +## Notes + +- Ensure Git is installed before use +- Safeguard your Git authentication credentials and do not commit them to public repositories +- It is recommended to test the synchronization functionality in a staging environment before deploying to production \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6b9a964bf60c60d7c72da67b315c7ab89fe2a84a --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ + + +# README + +## 项目简介 + +本项目是一个 Git 仓库同步工具集,包含用于将本地文件夹同步到远程 Git 仓库的工具脚本。 + +## 文件说明 + +### 1.py + +主要同步功能模块,提供以下函数: + +- **build_auth_url**: 构建带有认证信息的 Git URL +- **run_git**: 执行 Git 命令 +- **clone_repo**: 克隆远程仓库到本地 +- **get_latest_commit_time**: 获取仓库最新提交时间 +- **get_local_folder_latest_mtime**: 获取本地文件夹最新修改时间 +- **clear_folder**: 清理文件夹 +- **copy_folder_contents**: 复制文件夹内容 +- **commit_and_push**: 提交并推送更改 +- **sync_mode1/sync_mode2/sync_mode3**: 三种不同的同步模式 +- **main**: 主入口函数 + +### cmd1.py + +命令执行工具模块,提供以下功能: + +- **run_command_and_save_log**: 运行命令并保存日志 +- **clear_screen**: 清除屏幕显示 +- **main**: 主入口函数 + +### start.sh + +环境配置脚本,用于设置 Git 用户名和密码环境变量: + +```bash +export GIT_USERNAME +export GIT_PASSWORD +``` + +### last.log + +日志文件,记录命令执行结果。 + +## 使用方法 + +### 同步模式 + +项目支持三种同步模式: + +1. **sync_mode1**: 基础同步模式 +2. **sync_mode2**: 带清理的同步模式 +3. **sync_mode3**: 增量同步模式 + +### 运行方式 + +1. 配置 Git 认证信息(通过环境变量): + ```bash + export GIT_USERNAME="your_username" + export GIT_PASSWORD="your_password" + ``` + +2. 运行同步脚本: + ```bash + python 1.py + ``` + +3. 或运行命令工具: + ```bash + python cmd1.py + ``` + +## 注意事项 + +- 使用前请确保已安装 Git +- 请妥善保管 Git 认证信息,不要将其提交到公开仓库 +- 建议在测试环境先验证同步功能后再用于生产环境 \ No newline at end of file