- 仅对源仓库只做读取、拉取操作。
- 支持目标仓库项目自动创建。
- 支持目标仓库群组自动创建。
- 支持分支创建、修改同步,不支持删除。
- 支持标签创建、修改同步,不支持删除。
- 支持目标仓库与源仓库文件同步变动。
- 支持本地缓存,避免每次重启后全量从头拉取。
- 支持配置文件动态修改,无需重启服务。
- 支持且只支持白名单过滤项目。
- 支持
- centos7.6及以上、2核8G,存储不小于源库代码存储容量。
- 建议 git 1.8.3
- 开发者使用python3.7其他版本未做兼容性测试
python安装自行搜索解决
pip3 install -r requirements.txt
配置文件为yml格式
source_domain: source.example.gitlab.com #源地址
source_token: xxxxxx
source_protocol: http/https # 暂时只支持http和https方式
target_domain: target.example.gitlab.com #目标地址
target_protocol: http/https # 暂时只支持http和https方式
target_token: *****
target_api_token: *****
project_list: #项目白名单
- root/test
- demo
webhook_token: ***** #源gitlab的webhook token
webhook_port: 6000
repo_base_path: ./repo/ # 本地缓存代码库地址
log_path: ./logs #日志文件地址
lock_path: /lock # 防止重复执行的锁定文件地址
[Unit]
Description=gitsync deamon
After=rc-local.service
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/data/gitrsync/app
ExecStart=/usr/bin/python3 gitsync.py -c ./config.yml
Restart=always
[Install]
WantedBy=multi-user.target
完成编辑后
systemctl daemon-reload
systemctl start gitsync
- 只是ssh方式推送代码
- 支持ssh方式拉取代码