{"id":29539396,"url":"https://github.com/zywe03/install-rsync-gitbash","last_synced_at":"2025-07-17T07:02:03.441Z","repository":{"id":304311352,"uuid":"1018423263","full_name":"zywe03/install-rsync-gitbash","owner":"zywe03","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-12T09:15:34.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-12T10:09:54.388Z","etag":null,"topics":["git","gitbash","powershell","resync","shell","windows"],"latest_commit_sha":null,"homepage":"https://zywe.de/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zywe03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-12T08:20:45.000Z","updated_at":"2025-07-12T09:20:28.000Z","dependencies_parsed_at":"2025-07-12T10:21:07.693Z","dependency_job_id":null,"html_url":"https://github.com/zywe03/install-rsync-gitbash","commit_stats":null,"previous_names":["zywe03/install-rsync-gitbash"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zywe03/install-rsync-gitbash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zywe03%2Finstall-rsync-gitbash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zywe03%2Finstall-rsync-gitbash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zywe03%2Finstall-rsync-gitbash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zywe03%2Finstall-rsync-gitbash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zywe03","download_url":"https://codeload.github.com/zywe03/install-rsync-gitbash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zywe03%2Finstall-rsync-gitbash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265575397,"owners_count":23790765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","gitbash","powershell","resync","shell","windows"],"created_at":"2025-07-17T07:00:55.990Z","updated_at":"2025-07-17T07:02:03.425Z","avatar_url":"https://github.com/zywe03.png","language":"PowerShell","readme":"﻿# xw-rsync - Add rsync support to Git Bash to use the rsync utility in Windows environments.(为 Git Bash 添加 rsync 支持,在 Windows 环境中使用 rsync 工具)\n\n[English](#english) | [简体中文](#简体中文)\n\n---\n\n## English\n\n### What is it?\n`xw-rsync.ps1` is a fully open-source PowerShell script designed to install the rsync tool in the Windows Git Bash environment. It ensures perfect compatibility between rsync and Git Bash, providing a simple and efficient way to use rsync on Windows.\n\n### Problems it solves\n- **Git for Windows doesn't include rsync by default**\n- **`dup() in/out/err failed` errors**: Common fatal errors when manually installing rsync\n- **I/O pipe incompatibility issues**: Conflicts between file descriptors and pipe handling mechanisms from different environments\n- **Environment inconsistency compatibility problems**: SSH and rsync from different runtime environments\n- **Missing dependency issues**: Most online tutorials are outdated with incomplete or mismatched dependency libraries\n\n### Why 7 dependencies?\nThrough testing, we've found that using rsync 3.4.1 in the Git Bash environment requires 7 core dependencies:\n\n- `msys-iconv-2.dll` + `msys-charset-1.dll` - for character encoding support\n- `msys-intl-8.dll` - for internationalization support (needed by Git Bash tools)\n- `msys-xxhash-0.dll` - for xxHash hashing algorithm\n- `msys-lz4-1.dll` + `msys-zstd-1.dll` - for modern compression algorithms\n- `msys-crypto-3.dll` - for OpenSSL 3.x encryption support\n\nThese dependencies are downloaded and extracted from the official MSYS2 repository, totaling around 5MB.\n\n### Script Workflow\n\n```\n1. Environment Detection → 2. Permission Verification → 3. Tool Check → 4. Download and Install → 5. Test and Clean\n\n├── Detect Git installation location\n├── Verify administrator permissions\n├── Check for extraction tools (prefer ZSTD, fallback to 7-Zip)\n├── Download MSYS2 packages (rsync + 7 dependencies)\n├── Backup existing files and install to Git/usr/bin/\n├── Verify installation results and environment consistency\n└── Clean temporary files (including temporary ZSTD downloads)\n```\n\n### Features\n1. **One-click installation**: Automatically downloads and installs rsync and all dependencies\n2. **Official sources**: Downloads from the official MSYS2 repository, ensuring security and reliability\n3. **Environment compatibility**: Optimized specifically for the Git Bash environment\n4. **Automatic backup**: Backs up existing files before installation, supports restoration\n5. **Smart detection**: Dynamically identifies Git installation location, adapts to all Windows users\n6. **No PATH configuration needed**: Installs directly to the Git directory, automatically recognized by Git Bash\n\n### Quick Start\n\nOpen PowerShell as an administrator and copy-paste the following command to run:\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/xw-rsync.ps1'))\n```\n\nVerify installation:\n```bash\n# In Git Bash\nrsync --version\n```\n\n### Why run with administrator privileges?\n- **Administrator privileges required**: Installs to the Git system directory (`C:\\Program Files\\Git\\usr\\bin\\`), ensuring rsync and related dependencies run correctly in Git Bash\n\n### Installed Files\nInstalls to the Git system directory `C:\\Program Files\\Git\\usr\\bin\\`:\n- `rsync.exe` - rsync main program\n- 7 required DLL dependency files\n\n### Usage\n\n```bash\n# Basic usage\nrsync --version\n\n# File synchronization\nrsync -av source/ user@host:/destination/\n\n# With SSH key\nrsync -av -e \"ssh -i ~/.ssh/id_rsa\" source/ user@host:/destination/\n```\n\nAfter installation, rsync usage is identical to standard Linux environments. For more usage, please refer to the [rsync official documentation](https://rsync.samba.org/).\n\n### Project Files\n\n```\nxw-rsync/\n├── xw-rsync.ps1           # Main installation script\n├── test-rsync-env.sh      # Environment verification script (.sh version)\n├── uninstall-rsync.ps1    # Uninstallation script (cleans up all rsync files downloaded by the script)\n└── test-detection.ps1     # Environment verification script (.ps1 version)\n```\n\n### Other Script One-Click Run Commands\n\n#### Environment Verification Script\n\nRun .sh version using git bash:\n\n```bash\nbash \u003c(curl -s https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/test-rsync-env.sh)\n```\n\nRun .ps1 version using PowerShell:\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/test-detection.ps1'))\n```\n\n#### Uninstallation Script\n\nCopy and paste the following command to run the uninstallation script:\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/uninstall-rsync.ps1'))\n```\n\n### 🤝 Technical Support\n\n- **Other Open Source Projects:** \u003chttps://github.com/zywe03\u003e\n- **Author Homepage:** \u003chttps://zywe.de\u003e\n- **Issue Reporting:** [GitHub Issues](https://github.com/zywe03/install-rsync-gitbash/issues)\n- **Submit PR:** [Pull Requests](https://github.com/zywe03/install-rsync-gitbash/pulls)\n\n### 🙏 Acknowledgments\n\nThanks to all contributors and users who helped improve this project. Special thanks to:\n- MSYS2 project for providing reliable package sources\n- Git for Windows team for the excellent Git Bash environment\n- Community members who provided feedback and testing\n\n**⭐ If this project helps you, please give it a Star!**\n\n---\n\n---\n\n## 简体中文\n\n### 是什么？\n`xw-rsync.ps1` 是一个完全开源的 PowerShell 脚本，为 Windows Git Bash 环境安装 rsync 工具，确保 rsync 与 Git Bash 的完美兼容，提供了一种简单而有效的方法来在 Windows 环境中使用 rsync 工具\n\n### 解决的问题\n- **Git for Windows 默认不包含 rsync 工具**\n- **`dup() in/out/err failed` 错误**：手动安装 rsync 时常见的致命错误\n- **I/O 管道不兼容问题**：不同环境的文件描述符和管道处理机制冲突\n- **环境不一致导致的兼容性问题**：SSH 和 rsync 来自不同运行时环境\n- **依赖缺失问题**：网上教程大多过时，依赖库不完整或版本不匹配\n\n### 完整使用最新版rsync需要7 个依赖\n我们通过实际测试发现完整使用 rsync 3.4.1 在 Git Bash 环境中需要 7 个核心依赖：\n\n- `msys-iconv-2.dll` + `msys-charset-1.dll` - 字符编码支持\n- `msys-intl-8.dll` - 国际化支持（Git Bash 工具需要）\n- `msys-xxhash-0.dll` - xxHash 哈希算法\n- `msys-lz4-1.dll` + `msys-zstd-1.dll` - 现代压缩算法\n- `msys-crypto-3.dll` - OpenSSL 3.x 加密支持\n\n依赖是从 MSYS2 官方仓库中下载并提取出来的，总大小约为 5MB。\n\n### 脚本工作流程\n\n```\n1. 环境检测 → 2. 权限验证 → 3. 工具检查 → 4. 下载安装 → 5. 测试清理\n\n├── 检测 Git 安装位置\n├── 验证管理员权限\n├── 检查解压工具（优先 ZSTD，备选 7-Zip）\n├── 下载 MSYS2 官方包（rsync + 7个依赖）\n├── 备份现有文件并安装到 Git/usr/bin/\n├── 验证安装结果和环境一致性\n└── 清理临时文件（包含临时下载的 ZSTD）\n```\n\n### 功能特点\n1. **一键安装**：自动下载并安装 rsync 及所有依赖\n2. **官方源**：从 MSYS2 官方仓库下载，安全可靠\n3. **环境兼容**：专门针对 Git Bash 环境优化\n4. **自动备份**：安装前备份现有文件，支持恢复\n5. **智能检测**：动态识别 Git 安装位置，适配所有 Windows 用户\n6. **无需配置 PATH**：直接安装到 Git 目录，Git Bash 自动识别\n\n### 快速开始\n\n请以管理员身份打开 PowerShell，然后复制并粘贴以下命令以一键运行：\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/xw-rsync.ps1'))\n```\n\n验证安装：\n```bash\n# 在 Git Bash 中\nrsync --version\n```\n\n### 为什么需要管理员权限执行？\n- **需要管理员权限**：安装到 Git 系统目录（`C:\\Program Files\\Git\\usr\\bin\\`），这样做可以确保 rsync 和相关依赖能够在 Git Bash 中正确运行\n\n### 安装的文件\n安装到 Git 系统目录 `C:\\Program Files\\Git\\usr\\bin\\`：\n- `rsync.exe` - rsync 主程序\n- 7 个必需的 DLL 依赖文件\n\n### 使用方法\n\n```bash\n# 基本用法\nrsync --version\n\n# 文件同步\nrsync -av source/ user@host:/destination/\n\n# 配合 SSH 密钥\nrsync -av -e \"ssh -i ~/.ssh/id_rsa\" source/ user@host:/destination/\n```\n\n安装完成后，rsync 的使用方法与标准 Linux 环境完全一致。更多用法请参考 [rsync 官方文档](https://rsync.samba.org/)。\n\n### 项目文件\n\n```\nxw-rsync/\n├── xw-rsync.ps1           # 主安装脚本\n├── test-rsync-env.sh      # 环境验证脚本（.sh版本）\n├── uninstall-rsync.ps1    # 卸载脚本（清理脚本下载的rsync全部文件）\n└── test-detection.ps1     # 环境验证脚本（.ps1版本）\n```\n\n### 其他脚本一键运行命令\n\n#### 环境验证脚本\n\n使用 git 等 bash 运行 .sh 版本\n\n```bash\nbash \u003c(curl -s https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/test-rsync-env.sh)\n```\n\n使用 PowerShell 运行 .ps1 版本\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/test-detection.ps1'))\n```\n\n#### 卸载脚本\n\n复制并粘贴以下命令以运行卸载脚本：\n\n```powershell\niex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zywe03/install-rsync-gitbash/main/uninstall-rsync.ps1'))\n```\n\n### 🤝 技术支持\n\n- **其他开源项目：** \u003chttps://github.com/zywe03\u003e\n- **作者主页：** \u003chttps://zywe.de\u003e\n- **问题反馈：** [GitHub Issues](https://github.com/zywe03/install-rsync-gitbash/issues)\n- **提交PR：** [Pull Requests](https://github.com/zywe03/install-rsync-gitbash/pulls)\n\n### 🙏 致谢\n\n感谢所有为改进此项目做出贡献的贡献者和用户。特别感谢：\n- MSYS2 项目提供可靠的包源\n- Git for Windows 团队提供优秀的 Git Bash 环境\n- 提供反馈和测试的社区成员\n\n**⭐ 如果这个项目对您有帮助，请给个 Star 支持一下！**\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzywe03%2Finstall-rsync-gitbash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzywe03%2Finstall-rsync-gitbash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzywe03%2Finstall-rsync-gitbash/lists"}