Gitea docker 备份与恢复

r
发布于 2023-05-30 / 20 阅读
0

Gitea docker 备份与恢复

备份:

使用下面这个命令备份

 docker exec -u git -it -w /tmp 325624a5baa8 bash -c '/usr/local/bin/gitea dump'

其中325624~~~属于gitea的docker的CONTAINER ID

恢复:

docker compose up -d 启动容器

进入gitea容器执行下面命令

# open bash session in container
docker exec --user git -it 325624a5baa8 bash
# unzip your backup file within the container
unzip gitea-dump-1685422719.zip
cd gitea-dump-1685422719
# restore the gitea data
mv data/* /data/gitea
# restore the repositories itself
mv repos/* /data/git/repositories/
# adjust file permissions
chown -R git:git /data
# Regenerate Git Hooks
/usr/local/bin/gitea -c '/data/gitea/conf/app.ini' admin regenerate hooks

MySQL

mysql --default-character-set=utf8mb4 -u$MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE <gitea-db.sql

然后按照部署的方法导入即可