{"id":28214045,"url":"https://github.com/vzool/git_sync","last_synced_at":"2026-05-01T19:31:28.895Z","repository":{"id":216779440,"uuid":"740375667","full_name":"vzool/git_sync","owner":"vzool","description":"[DRAFT] Easily sync repositories between Git servers","archived":false,"fork":false,"pushed_at":"2024-03-30T05:30:09.000Z","size":91,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T20:49:13.855Z","etag":null,"topics":["git","git-mirror","gitea","gogs","sync"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vzool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-01-08T08:11:50.000Z","updated_at":"2024-12-30T22:28:58.000Z","dependencies_parsed_at":"2024-01-21T14:27:11.713Z","dependency_job_id":"b6d5857f-d143-48fe-b54c-e471d6298d1b","html_url":"https://github.com/vzool/git_sync","commit_stats":null,"previous_names":["vzool/git_sync"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/vzool/git_sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fgit_sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fgit_sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fgit_sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fgit_sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vzool","download_url":"https://codeload.github.com/vzool/git_sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fgit_sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32510596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["git","git-mirror","gitea","gogs","sync"],"created_at":"2025-05-17T20:12:09.045Z","updated_at":"2026-05-01T19:31:28.880Z","avatar_url":"https://github.com/vzool.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [DRAFT] git_sync: Easily sync repositories between Git servers\n\n## Overview\n\nThis script automates the process of syncing repositories from one Git server to another. It's designed to be flexible and supports multiple Git servers storage target through plugins.\n\n#### Target Namespaces \n\n- **User mode** (Default): When to sync `git@github.com:vzool/git_sync.git` for instance, `git_sync` will create a new repository name `git_sync.vzool.github.com` under current username `vzool`.\n\n- **Organization mode**: When to sync `git@github.com:vzool/git_sync.git` for instance, `git_sync` will create a new repository name `git_sync` under a new organization name `vzool.github.com`.\n\n\nSo, all things will be separated automatically by namespaces. :)\n\n#### Supported Git Servers\n\n- [x] [Gitea](https://about.gitea.com/): tested on Gitea Server v1.21.3.\n- [x] [Gogs](https://gogs.io/): tested on Gogs Server v0.14.0+dev.\n- [x] [GitLab Community](https://about.gitlab.com/community/): tested on GitLab Community Server v16.7.3.\n- [x] [GitLab PaaS](https://about.gitlab.com/). (**Note**: Create Organization not allowed)\n- [x] [OneDev](https://onedev.io/): tested on OneDev Server v9.5.1.\n- [ ] [Github](https://github.com/).\n- [ ] [BitBucket](https://bitbucket.org/).\n- [ ] [CodeBase](https://www.codebasehq.com/).\n\n## Installation / Update\n\n```bash\ncurl -s https://raw.githubusercontent.com/vzool/git_sync/main/install.sh | bash -s --\n```\n\n## Uninstall\n\n```bash\ngit_sync uninstall\n\n# OR\n\ncurl -s https://raw.githubusercontent.com/vzool/git_sync/main/install.sh | bash -s -- remove\n```\n\n## Usage\n\n```bash\n# 1) Create .git_sync directory at home directory\ngit_sync init \n# 2) Edit the list to add, update or remove of repositories to sync\ngit_sync list\n# 3) Show loaded env\ngit_sync env\n# 4) Run without confirmation\ngit_sync -y\n```\n\n- Ensure dependencies: Verify that required commands like git and curl are installed.\n- Set up configuration:\n    - If a configuration file doesn't exist, run git_sync init to create one interactively.\n    - You can also manually edit the configuration file.\n- Run the script:\n    - Use the -v flag for verbose output.\n    - Use the -y flag to skip confirmation prompts.\n\n## Key Features\n\n- Syncs repositories across Git servers: Clones repositories locally and pushes them to a target Git server, utilizing Git server APIs for organization and repository management.\n- Supports multiple Git servers: Uses plugins to interact with different Git server platforms.\n- Configurable: Employs a configuration file for settings and preferences.\n- User-friendly: Offers interactive prompts and confirmations.\n- Provides additional commands:\n    - git_sync init: Create/Edit config file based on user input using interactive prompts.\n    - git_sync list: Edit the list of repositories to sync.\n    - git_sync config: Edit configuration variables.\n    - git_sync env: Show loaded env.\n    - git_sync size: Shows the size of locally stored repositories.\n    - git_sync plugins: List available plugins.\n    - git_sync install: Install git_sync.\n    - git_sync uninstall: Uninstall git_sync.\n    - git_sync version: Output version information and exit.\n\n## Requirements\n\n- SSH key pair already set for the Gitea server.\n- SSH key pair already set for all source Git servers.\n- `git` command line tool.\n- Accesss Token with the following permissions:\n    - write:organization\n    - write:repository\n\n## Example\n\nTo sync repositories listed in repos.txt to a Gitea server, run:\n\n```bash\n$~\u003e git_sync init # Create .git_sync directory at home directory\n$~\u003e git_sync config # Show default config in editor\n$~\u003e git_sync -y # Run without confirmation\n\n# OR\n\n$~\u003e ENV=\"/path/to/.env\" git_sync\n\n# OR\n\n$~\u003e TOKEN=\"xxxxxx\" USER=\"vzool\" HTTP_HOST=\"http://192.168.88.248:3000\" SSH_HOST=\"git@192.168.88.248\" LIST=\"/path/to/git_sync_repo.txt\" git_sync\n\n# OR\n\n$~\u003e TOKEN=\"xxxxxx\" USER=\"vzool\" HTTP_HOST=\"http://192.168.88.248:3000\" SSH_HOST=\"git@192.168.88.248\" SSH_PORT=\"22\" LIST=\"git_sync_repo.txt\" DIR=\"repo/\" git_sync\n```\n\n## Anatomy\n\n![00-local-file-storage](images/00-local-file-storage.png)\n![01-configuration-file](images/01-configuration-file.png)\n![02-repositories-list.png](images/02-repositories-list.png)\n\n# Plugins Development\n\nBefore you go any further replace `xxx` prefix everywhere with your provider git server protocol, e.g. `gitrat`.\n- Create a `xxx_plugins.sh` file in the repository's root.\n- Write the following functions inside `xxx_plugins.sh`:\n    - xxx_plugin_version\n    - xxx_required_permissions\n    - xxx_user_can_create_repo_flag\n    - xxx_remote_origin (optional) if this function exists the script will change the default execution path\n    - xxx_custom_push_updates (optional, but required with xxx_remote_origin function)\n    - xxx_check_repository\n    - xxx_user_create_repository\n    - xxx_check_organization\n    - xxx_create_organization\n    - xxx_organization_create_repository\n- Implement those functions.\n- Test your implementation.\n\n## Further Information\n\n**Configuration file**: See config.example.sh for configuration options.\n\n**Supported Git servers**: Currently supports Gitea only.\n\n**Plugins**: Explore available plugins in the root directory, they are end up with `_plugin.sh` suffix.\n\n**Contributing**: Feel free to contribute to the project!\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Author\n\nAbdelaziz Elrashed (c) 2024\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzool%2Fgit_sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvzool%2Fgit_sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzool%2Fgit_sync/lists"}