{"id":19022663,"url":"https://github.com/donhui/gitlab-backup-script","last_synced_at":"2026-05-13T21:35:31.023Z","repository":{"id":94163484,"uuid":"55115173","full_name":"donhui/gitlab-backup-script","owner":"donhui","description":"gitlab repositories backup script（有备无患，方能安心）","archived":false,"fork":false,"pushed_at":"2020-03-24T03:31:49.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T18:41:47.582Z","etag":null,"topics":["backup-script","backup-solution","gitlab","gitlab-backup"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/donhui.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}},"created_at":"2016-03-31T02:53:22.000Z","updated_at":"2021-12-10T06:31:02.000Z","dependencies_parsed_at":"2023-03-25T22:47:38.996Z","dependency_job_id":null,"html_url":"https://github.com/donhui/gitlab-backup-script","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/donhui/gitlab-backup-script","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donhui%2Fgitlab-backup-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donhui%2Fgitlab-backup-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donhui%2Fgitlab-backup-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donhui%2Fgitlab-backup-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donhui","download_url":"https://codeload.github.com/donhui/gitlab-backup-script/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donhui%2Fgitlab-backup-script/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33001266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["backup-script","backup-solution","gitlab","gitlab-backup"],"created_at":"2024-11-08T20:27:08.906Z","updated_at":"2026-05-13T21:35:31.005Z","avatar_url":"https://github.com/donhui.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 缘由（Why?）\ngitlab仓库备份一般通过rsync的方式，将仓库数据同步到其他机器\n\n但是，如果仓库损坏的，同步到备机上的也是损坏的\n\n甚至，如果仓库被误删的话，备机上的也会被同步删掉\n\n所以才有了这个项目，专门用来备份git仓库，无惧仓库损坏或被误删～\n\n# gitlab-backup-script 使用说明\n\n通过使用python-gitlab调用gitlab API遍历repositories对其进行备份。  \n\n如果git repository在本地存在则进行git fetch，反之则进行git clone。\n\n1. 安装依赖\n\u003e ```\n\u003e pip install -r requirements.txt\n\u003e 注意：\n\u003e - python版本应为2.7(python-gitlab不兼容python2.6)；建议将其加入到环境变量中\n\u003e - 根据需要有可能需要安装setuptools、pip\n\u003e ```\n\n2. 修改自定义配置\n\u003e ```\n\u003e 修改settings.py中的配置（gitlab相关配置、是否允许邮件通知、smtp相关配置）\n\u003e 注意：\n\u003e - gitlab的用户必须是管理员\n\u003e - 机器本地的`ssh key`需要添加到gitlab管理员账号下，以便可以使用ssh协议clone/fetch仓库代码\n\u003e ```\n\n3. 运行脚本\n\u003e ```\n\u003e python gitlab-backup.py\n\u003e ```\n\n4. 建议\n\u003e ```\n\u003e 建议将备份任务放到crontab定时任务中\n\u003e - 01 02 * * * . $HOME/.bash_profile;/usr/bin/python /data/gitlab-backup/gitlab-backup.py\u003e/var/log/gitlab-backup.log 2\u003e\u00261\n\u003e - git环境变量应追加到.bash_profile文件中的PATH中\n\u003e ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonhui%2Fgitlab-backup-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonhui%2Fgitlab-backup-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonhui%2Fgitlab-backup-script/lists"}