Kirin H.

备份 GitHub 仓库

因为我开始使用 GitHub Issues 来追踪问题,所以需要定期备份以防万一。

simonw 在推荐 GitHub Issues 的同时,也推荐了他自己写的 github-to-sqlite 来备份,试了一下,感觉确实不错。

安装

使用 pip 安装

pip install github-to-sqlite

或者,使用 uv 安装:

uv tool install github-to-sqlite

使用

先去 https://github.com/settings/tokens 生成一个 token,授予相应的 Issues 和 Pull requests 等的读权限。

# 创建和打开保存备份文件的目录
mkdir github-to-sqlite
cd github-to-sqlite
# 添加 token
uvx github-to-sqlite auth
# 粘贴刚才生成的 token
# 备份 Issues
uvx github-to-sqlite issues github.db simonw/datasette
# 备份 Issue Comments
uvx github-to-sqlite issue-comments github.db simonw/datasette

References

#Github #Backup