{"id":22801684,"url":"https://github.com/pojntfx/octarchive","last_synced_at":"2025-09-25T14:31:28.757Z","repository":{"id":56760064,"uuid":"524687948","full_name":"pojntfx/octarchive","owner":"pojntfx","description":"Simple tool to back up all repos on a GitHub/Gitea account to a local folder.","archived":false,"fork":false,"pushed_at":"2024-07-16T16:55:20.000Z","size":309,"stargazers_count":113,"open_issues_count":0,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-09T12:14:56.395Z","etag":null,"topics":["backup","clone","gitea","github","golang","mirror"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pojntfx.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":"2022-08-14T14:02:41.000Z","updated_at":"2025-01-07T13:49:30.000Z","dependencies_parsed_at":"2024-11-13T15:52:13.443Z","dependency_job_id":null,"html_url":"https://github.com/pojntfx/octarchive","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"cee17120dd2005143036f588b9840237e749626c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pojntfx%2Foctarchive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pojntfx%2Foctarchive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pojntfx%2Foctarchive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pojntfx%2Foctarchive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pojntfx","download_url":"https://codeload.github.com/pojntfx/octarchive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234207616,"owners_count":18796284,"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":["backup","clone","gitea","github","golang","mirror"],"created_at":"2024-12-12T08:12:25.925Z","updated_at":"2025-09-25T14:31:28.364Z","avatar_url":"https://github.com/pojntfx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg alt=\"Project icon\" style=\"vertical-align: middle;\" src=\"./docs/icon.svg\" width=\"128\" height=\"128\" align=\"left\"\u003e\n\n# Octarchive\n\nSimple tool to back up all repos on a GitHub/Gitea account to a local folder.\n\n\u003cbr/\u003e\n\n[![hydrun CI](https://github.com/pojntfx/octarchive/actions/workflows/hydrun.yaml/badge.svg)](https://github.com/pojntfx/octarchive/actions/workflows/hydrun.yaml)\n[![Docker CI](https://github.com/pojntfx/octarchive/actions/workflows/docker.yaml/badge.svg)](https://github.com/pojntfx/octarchive/actions/workflows/docker.yaml)\n![Go Version](https://img.shields.io/badge/go%20version-%3E=1.18-61CFDD.svg)\n[![Go Reference](https://pkg.go.dev/badge/github.com/pojntfx/octarchive.svg)](https://pkg.go.dev/github.com/pojntfx/octarchive)\n[![Matrix](https://img.shields.io/matrix/octarchive:matrix.org)](https://matrix.to/#/#octarchive:matrix.org?via=matrix.org)\n\n## Overview\n\nOctarchive is a simple backup utility that clones all repos from a GitHub/Gitea account to a local folder for storage.\n\nIt enables you to:\n\n- **Backup your work**: In case your GitHub account is breached or gets banned, Octarchive ensures you always have a local copy available.\n- **Mirror your account**: If your internet connection is slow or GitHub is banned in your jurisdiction, you can use Octarchive and a web server to mirror your repos.\n- **Automate processes**: By exposing all of your repos to the filesystem, otherwise tedious processes such as bumping copyright dates or updating names become easy.\n\n## Installation\n\n### Containerized\n\nYou can get the OCI image like so:\n\n```shell\n$ podman pull ghcr.io/pojntfx/octarchive\n```\n\n### Natively\n\nStatic binaries are available on [GitHub releases](https://github.com/pojntfx/octarchive/releases).\n\nOn Linux, you can install them like so:\n\n```shell\n$ curl -L -o /tmp/octarchive \"https://github.com/pojntfx/octarchive/releases/latest/download/octarchive.linux-$(uname -m)\"\n$ sudo install /tmp/octarchive /usr/local/bin\n```\n\nOn macOS, you can use the following:\n\n```shell\n$ curl -L -o /tmp/octarchive \"https://github.com/pojntfx/octarchive/releases/latest/download/octarchive.darwin-$(uname -m)\"\n$ sudo install /tmp/octarchive /usr/local/bin\n```\n\nOn Windows, the following should work (using PowerShell as administrator):\n\n```shell\nPS\u003e Invoke-WebRequest https://github.com/pojntfx/octarchive/releases/latest/download/octarchive.windows-x86_64.exe -OutFile \\Windows\\System32\\octarchive.exe\n```\n\nYou can find binaries for more operating systems and architectures on [GitHub releases](https://github.com/pojntfx/octarchive/releases).\n\n## Tutorial\n\n### 1. Do a manual backup with `octarchive`\n\nFirst, export your GitHub (or Gitea) API token like so:\n\n```shell\n$ export GITHUB_TOKEN='mygithubtoken'\n```\n\nIf you're using Gitea, also export your API endpoint like so:\n\n```shell\n$ export GITHUB_API='https://try.gitea.io/api/'\n```\n\nNow, start the manual backup, including all the repos of the organizations that you're part of:\n\n```shell\n$ octarchive --orgs\n{\"level\":\"info\",\"time\":\"2022-08-15T00:25:39+02:00\",\"message\":\"Getting user\"}\n{\"level\":\"info\",\"time\":\"2022-08-15T00:25:40+02:00\",\"message\":\"Getting organizations for user\"}\n# ...\nCloning   6% [========\u003e                                                                                                                                                           ] (16/263, 7 repo/s) [1s:32s]{\"level\":\"info\",\"cloneURL\":\"https://github.com/pojntfx/dwm.git\",\"filePath\":\"/home/pojntfx/.local/share/octarchive/var/lib/octarchive/data/1660518181/pojntfx/dwm\",\"time\":\"2022-08-15T01:03:09+02:00\",\"message\":\"Cloning repo\"}\n# ...\n```\n\nYou should now find the repos in `${HOME}/.local/share/octarchive/var/lib/octarchive/data`.\n\nFor more information, see the [reference](#reference).\n\n### 2. Schedule backups with systemd Timers\n\nIn most cases, you'll want to schedule backups periodically; an excellent way to do so is to use [systemd Timers](https://wiki.archlinux.org/title/Systemd/Timers). To schedule a weekly backup of all of your repos, run the following:\n\n```shell\n$ sudo tee /etc/systemd/system/octarchive.service\u003c\u003c'EOT'\n[Unit]\nDescription=Octarchive backup\n\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/octarchive --orgs\nEnvironment=\"HOME=/root\"\nEnvironment=\"GITHUB_TOKEN=mygithubtoken\"\n\n[Install]\nWantedBy=multi-user.target\nEOT\n$ sudo tee /etc/systemd/system/octarchive.timer\u003c\u003c'EOT'\n[Unit]\nDescription=Run Octarchive weekly\n\n[Timer]\nOnCalendar=weekly\nPersistent=true\n\n[Install]\nWantedBy=timers.target\nEOT\n$ sudo systemctl daemon-reload\n$ sudo systemctl enable octarchive.timer --now\n```\n\nNote that this will create a fresh directory every time you run the backup, which might fill up your disk space quite quickly; if you want to instead remove the old backup every time you do a new one, append `--timestamp current` to the `ExecStart` line of the service.\n\nYou should find the repos in `/root/.local/share/octarchive/var/lib/octarchive/data`.\n\nFor more information, see the [reference](#reference).\n\n🚀 **That's it!** We hope you enjoy using Octarchive.\n\n## Reference\n\n### Command Line Arguments\n\n```shell\n$ octarchive --help\nUsage of octarchive:\n  -api string\n        GitHub/Gitea API endpoint to use (can also be set using the GITHUB_API env variable) (default \"https://api.github.com/\")\n  -concurrency int\n        Maximum amount of repositories to clone concurrently (default 20)\n  -dst string\n        Base directory to clone repos into (default \"/home/pojntfx/.local/share/octarchive/var/lib/octarchive/data\")\n  -fresh\n        Clear timestamp directory before starting to clone\n  -orgs\n        Also clone repos of all orgs that the user is part of\n  -timestamp string\n        Timestamp to use as the directory for this clone session (default \"1660513831\")\n  -token string\n        GitHub/Gitea API access token (can also be set using the GITHUB_TOKEN env variable)\n  -verbose int\n        Verbosity level (0 is disabled, default is info, 7 is trace) (default 5)\n```\n\n### Environment Variables\n\nYou can set the following environment variables, which correspond to the values that can be set using the following flags:\n\n| Environment Variable | Flag      |\n| -------------------- | --------- |\n| `GITHUB_API`         | `--api`   |\n| `GITHUB_TOKEN`       | `--token` |\n\n## Acknowledgements\n\n- [go-git/go-git](https://github.com/go-git/go-git) provides the Git library.\n- [Font Awesome](https://fontawesome.com/) provides the assets used for the icon and logo.\n\n## Contributing\n\nTo contribute, please use the [GitHub flow](https://guides.github.com/introduction/flow/) and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).\n\nTo build and start a development version of Octarchive locally, run the following:\n\n```shell\n$ git clone https://github.com/pojntfx/octarchive.git\n$ cd octarchive\n$ make depend\n$ make \u0026\u0026 sudo make install\n$ export GITHUB_TOKEN='mygithubtoken'\n$ octarchive\n```\n\nHave any questions or need help? Chat with us [on Matrix](https://matrix.to/#/#octarchive:matrix.org?via=matrix.org)!\n\n## License\n\nOctarchive (c) 2024 Felicitas Pojtinger and contributors\n\nSPDX-License-Identifier: AGPL-3.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpojntfx%2Foctarchive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpojntfx%2Foctarchive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpojntfx%2Foctarchive/lists"}