当前位置: 首页 > news >正文

gitea的git库备份与恢复

文章目录

    • gitea库的备份与恢复
    • 概述
    • 笔记
    • 实验环境
    • 更新git for windows
    • 更新 TortoiseGit
    • 备份已经存在的gitea的git库目录
    • 使用gitea本身来备份所有git库目录
    • 将gitea库恢复到新目录
    • m1
    • m2
    • m3
    • 启动gitea - 此时已经恢复完成
    • FETCH_HEAD 中有硬写位置
    • 再查一下app.ini, 是否改漏了。
      • m1
      • m2
    • 总结
    • 用gitea备份/恢复库无解
    • 折中的方法
    • END

gitea库的备份与恢复

概述

在本地搭建了gitea的git库.
最开始用的gitea 1.16.8。
本人比较手欠,看见新版本就想升级。
换了几个高版本后,渐渐发现,在启动gitea服务时有以前不曾见过的错误提示(e.g. git库的健康检查错误之类的)。
以前一直用旧版的时候,不曾发现报错问题。
就怀疑是升级后,gitea新版对旧版格式不兼容引起的。因为我的git也换了好几次新版本。
想对现有的本地gitea的git库目录进行备份与恢复,看看能不能解决启动gitea新版的报错问题。
主要还是心里有点怕,为以后gitea的git库损坏和迁移做准备。

笔记

实验环境

win10x64
Git-2.45.1-64-bit.exe
TortoiseGit-2.16.0.0-64bit.msi
gitea-1.22.0-gogit-windows-4.0-amd64.exe.7z

更新git for windows

当前的git也不算旧

E:\git_rep_local>git --version
git version 2.44.0.windows.1

安装 Git-2.45.1-64-bit.exe

更新 TortoiseGit

当前版本
TortoiseGit 2.15.0.0 (C:\Program Files\TortoiseGit\bin)
安装 TortoiseGit-2.16.0.0-64bit.msi
安装完TortoiseGit-2.16.0.0-64bit.msi后,要关闭计算机,再重启计算机。否则计算机桌面反复启动。
重启后,查看git和TortoiseGit版本,都是最新的了。
在这里插入图片描述

备份已经存在的gitea的git库目录

这个得先做,而且还要保留备份一段时间(确认更新了gitea的库运行正常了),免得发生杯具。
在这里插入图片描述

使用gitea本身来备份所有git库目录

我已经做了实验验证过了,现在重新做实验,顺便记录笔记。
停掉了gitea服务,删掉了目录 e:\git_rep_local
将备份中的git_rep_local目录,释放到 e:
在这里插入图片描述
我用的旧版gitea和新版差的不多。
旧版为gitea-1.21.10
在这里插入图片描述
新版为 gitea-1.22.0-gogit-windows-4.0-amd64.exe.7z
必须用当前原版的gitea(升级前,正常能用的旧版gitea)的来做备份, 否则报错后,库备份的不能用于恢复。

在这里插入图片描述

gitea运行时,要依赖git.
我这里,为了避免环境变量污染,将PATH值都清掉了
先写个.bat, 将git环境备齐。
运行 env_git.bat.

E:\git_rep_local>git --version
git version 2.45.1.windows.1

看到git已经是刚升级过的2.45.1
开始备份(请确认没有正在运行的gitea实例)

gitea-1.21.10-gogit-windows-4.0-amd64.exe dump

不是马上能备份完的,等待命令行结束。
在这里插入图片描述
只有用旧版(原版)的gitea备份git库,才能正确完成,不能用新版的gitea.
如果备份时命令行报错,就要从备份的原版gitea的git库中重新备份。

将gitea库恢复到新目录

恢复到新目录的意义(可以在本机的新的目录开始gitea实例,或者在其他计算机上部署本地git库的副本)
建立 E:\git_rep_local_v1,作为空的新目录。
将env_git.bat,gitea-1.22.0-gogit-windows-4.0-amd64.exe,gitea-dump-1716879579.zip拷贝到新目录。
在这里插入图片描述

先将gitea-dump-1716879579.zip中的东西释放到E:\git_rep_local_v1
在这里插入图片描述
E:\git_rep_local_v1\respos 改名为 gitea-repositories
删掉 E:\git_rep_local_v1\custom\conf\app.ini , 原因 : 这个目录中底层只有一个app.ini,和 E:\git_rep_local_v1\app.ini内容一致,经过实验,发现,最终与运行的配置文件是E:\git_rep_local_v1\custom\conf\app.ini 。等一会将E:\git_rep_local_v1\app.ini,再覆盖回来。

修改 E:\git_rep_local_v1\app.ini 中关于E:\git_rep_local的内容到 E:\git_rep_local_v1
我这里改了2处
在这里插入图片描述
将改完的 E:\git_rep_local_v1\app.ini 拷贝为 E:\git_rep_local_v1\custom\conf\app.ini, 否则看不到存在的git库,且库位置也变到了\data下面的gitea-repositories

将原始gitea的git目录 E:\git_rep_local 改名为 E:\git_rep_local_v0, 这样如果在改E:\git_rep_local_v1中有关于原始库路径E:\git_rep_local时,如果没改对(或漏改),容易看出问题。

运行 E:\git_rep_local_v1\env_git.bat
找到自己计算机上sqlite3的官方工具目录 E:\tools\database\sqlite3.44.2\sqlite-tools-win-x64-3440200
在这里插入图片描述
在E:\git_rep_local_v1\env_git.bat命令行中临时添加sqlite3的环境变量

set path=E:\tools\database\sqlite3.44.2\sqlite-tools-win-x64-3440200;%path%

现在看一下PATH,git版本,sqlite3版本

E:\git_rep_local_v1>path
PATH=E:\tools\database\sqlite3.44.2\sqlite-tools-win-x64-3440200;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\binE:\git_rep_local_v1>sqlite3.exe --version
3.44.2 2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f (64-bit)E:\git_rep_local_v1>git --version
git version 2.45.1.windows.1

现在环境全了。
修改 gitea-db.sql
因为我采用的是sqlite3数据库,库的位置是在gitea-db.sql描述的。
在gitea-db.sql中查找 E: (我的库在E盘)子字样的字符串,最终可以找到记录.git库的磁盘物理位置
能找到几处,都改成实际的新库位置。有些SQL还记录要使用的gitea版本,也一起改了。

m1

INSERT INTO `app_state` (`id`, `revision`, `content`) VALUES ('runtime-state',6,'{"last_app_path":"E:/git_rep_local/gitea-1.21.10-gogit-windows-4.0-amd64.exe","last_custom_conf":"E:\\git_rep_local\\custom\\conf\\app.ini"}');

将磁盘位置改为自己的新git目录 E:\git_rep_local_v1

INSERT INTO `app_state` (`id`, `revision`, `content`) VALUES ('runtime-state',6,'{"last_app_path":"E:/git_rep_local_v1/gitea-1.22.0-gogit-windows-4.0-amd64.exe","last_custom_conf":"E:\\git_rep_local_v1\\custom\\conf\\app.ini"}');

哦, 原来使用哪个app.ini这里也记录了。

m2

INSERT INTO `notice` (`id`, `type`, `description`, `created_unix`) VALUES (872,1,'Repository garbage collection failed for E:\git_rep_local_v0\gitea-repositories\xx\my_local_git_prj.git. Stdout: ' || X'0a' || 'Error: context deadline exceeded',1715561802);

修改如下

INSERT INTO `notice` (`id`, `type`, `description`, `created_unix`) VALUES (872,1,'Repository garbage collection failed for E:\git_rep_local_v1\gitea-repositories\xx\my_local_git_prj.git. Stdout: ' || X'0a' || 'Error: context deadline exceeded',1715561802);

m3

现在将 gitea-db.sql 导入gitea的sqlite3数据库。
这个导入,必须在没有gitea.db的情况下进行。如果存在gitea.db,需要删掉再运行命令行。

sqlite3.exe gitea.db < gitea-db.sql

这个导入需要1分钟左右。
在这里插入图片描述

启动gitea - 此时已经恢复完成

为了方便,写个脚本(run_gitea.bat)来运行gitea

set PATH=C:\Program Files\Git\cmd;%PATH%
call gitea-1.22.0-gogit-windows-4.0-amd64.exe

运行后,发现有lfs报错。且提示从1.19之后,已经去掉了lfs选项。
查看配置文件,
在这里插入图片描述
删除app.ini中的LFS_CONTENT_PATH选项
在这里插入图片描述

再运行 run_gitea.bat
看到警告

2024/05/28 16:16:45 ...dules/setting/log.go:72:prepareLoggerConfig() [E] Deprecation: config option `[log].ROUTER` presents, please use `[log].logger.router.MODE` instead because this fallback will be/has been removed in 1.21

查找log选项
在这里插入图片描述
改为提示中的选项试试

[log]
logger.router.MODE = console

又看到有警告

2024/05/28 16:22:38 ...dules/setting/log.go:72:prepareLoggerConfig() [E] Deprecation: config option `[log].ROUTER` presents, please use `[log].logger.router.MODE` instead because this fallback will be/has been removed in 1.21

查找选项log
在这里插入图片描述
改为如下

[log]
logger.router.MODE = console
LEVEL = info
ROOT_PATH = E:/git_rep_local/log
logger.router.MODE = console

再试试

现在启动后,只有一个警告

2024/05/28 16:26:11 routers/init.go:116:InitWebInstalled() [I] Git version: 2.45.1 (home: E:\git_rep_local_v1\data\home)2024/05/28 16:26:11 routers/init.go:118:InitWebInstalled() [W] sha256 hash support is disabled - requires Git >= 2.42. Gogit is currently unsupported.

因为现在git版本已经为2.45.1, 已经>=2.42, sha256被禁用了。这个正常,就不管了。
现在gitea启动的命令行输出如下,只有一个sha256警告

E:\git_rep_local_v1>set PATH=C:\Program Files\Git\cmd;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\binE:\git_rep_local_v1>call gitea-1.22.0-gogit-windows-4.0-amd64.exe
2024/05/28 16:55:45 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 141284
2024/05/28 16:55:45 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.22.0 built with GNU Make 4.3, go1.22.3 : bindata, sqlite, sqlite_unlock_notify
2024/05/28 16:55:45 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/05/28 16:55:45 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: E:/git_rep_local_v1/gitea-1.22.0-gogit-windows-4.0-amd64.exe
2024/05/28 16:55:45 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: E:\git_rep_local_v1
2024/05/28 16:55:45 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: E:\git_rep_local_v1\custom
2024/05/28 16:55:45 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: E:\git_rep_local_v1\custom\conf\app.ini
2024/05/28 16:55:45 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/05/28 16:55:46 routers/init.go:116:InitWebInstalled() [I] Git version: 2.45.1 (home: E:\git_rep_local_v1\data\home)
2024/05/28 16:55:46 routers/init.go:118:InitWebInstalled() [W] sha256 hash support is disabled - requires Git >= 2.42. Gogit is currently unsupported.
2024/05/28 16:55:46 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/05/28 16:55:46 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\attachments
2024/05/28 16:55:46 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\avatars
2024/05/28 16:55:46 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\repo-avatars
2024/05/28 16:55:46 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\lfs
2024/05/28 16:55:46 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\repo-archive
2024/05/28 16:55:46 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\packages
2024/05/28 16:55:46 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\actions_log
2024/05/28 16:55:46 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/05/28 16:55:46 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\actions_artifacts
2024/05/28 16:55:46 routers/init.go:138:InitWebInstalled() [I] SQLite3 support is enabled
2024/05/28 16:55:46 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/05/28 16:55:46 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/05/28 16:55:46 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3
2024/05/28 16:55:46 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2024/05/28 16:55:46 routers/init.go:144:InitWebInstalled() [I] ORM engine initialization successful!
2024/05/28 16:55:46 ...er/issues/indexer.go:76:func1() [I] PID 141284: Initializing Issue Indexer: bleve
2024/05/28 16:55:46 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2024/05/28 16:55:46 ...xer/stats/indexer.go:87:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2024/05/28 16:55:46 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 1.9888ms
2024/05/28 16:55:46 ...s/actions/cleanup.go:36:cleanExpiredArtifacts() [I] Found 0 expired artifacts
2024/05/28 16:55:46 ...s/actions/cleanup.go:60:cleanNeedDeleteArtifacts() [I] Found 0 artifacts pending deletion
2024/05/28 16:55:46 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/05/28 16:55:46 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2024/05/28 16:55:46 cmd/web.go:311:listen() [I] LFS server enabled
2024/05/28 16:55:46 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 141284

去网gitea页端看看 http://localhost:3000/
此时,用户名和密码都是以前自己设置好的。
进去之后,看到没有自己的git库。
看日志,发现访问的还是E:\git_rep_local,估计是导出的data目录还是记录的以前的旧位置。
将data目录删除。
在这里插入图片描述
重新运行run_gitea.bat,看看gitea能不能生成自己需要的data目录中的东西。


E:\git_rep_local_v1>set PATH=C:\Program Files\Git\cmd;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\binE:\git_rep_local_v1>call gitea-1.22.0-gogit-windows-4.0-amd64.exe
2024/05/28 17:04:07 cmd/web.go:242:runWeb() [I] Starting Gitea on PID: 154472
2024/05/28 17:04:07 cmd/web.go:111:showWebStartupMessage() [I] Gitea version: 1.22.0 built with GNU Make 4.3, go1.22.3 : bindata, sqlite, sqlite_unlock_notify
2024/05/28 17:04:07 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/05/28 17:04:07 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: E:/git_rep_local_v1/gitea-1.22.0-gogit-windows-4.0-amd64.exe
2024/05/28 17:04:07 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: E:\git_rep_local_v1
2024/05/28 17:04:07 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: E:\git_rep_local_v1\custom
2024/05/28 17:04:07 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: E:\git_rep_local_v1\custom\conf\app.ini
2024/05/28 17:04:07 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/05/28 17:04:08 routers/init.go:116:InitWebInstalled() [I] Git version: 2.45.1 (home: E:\git_rep_local_v1\data\home)2024/05/28 17:04:08 routers/init.go:118:InitWebInstalled() [W] sha256 hash support is disabled - requires Git >= 2.42. Gogit is currently unsupported.
2024/05/28 17:04:08 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/05/28 17:04:08 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\attachments
2024/05/28 17:04:08 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\avatars
2024/05/28 17:04:08 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\repo-avatars
2024/05/28 17:04:08 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\lfs
2024/05/28 17:04:08 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\repo-archive
2024/05/28 17:04:08 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\packages
2024/05/28 17:04:08 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\actions_log
2024/05/28 17:04:08 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local2024/05/28 17:04:08 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at E:\git_rep_local_v1\data\actions_artifacts
2024/05/28 17:04:08 routers/init.go:138:InitWebInstalled() [I] SQLite3 support is enabled
2024/05/28 17:04:08 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/05/28 17:04:08 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/05/28 17:04:08 cmd/web.go:194:serveInstalled() [I] PING DATABASE sqlite3
2024/05/28 17:04:08 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2024/05/28 17:04:08 routers/init.go:144:InitWebInstalled() [I] ORM engine initialization successful!
2024/05/28 17:04:10 ...er/issues/indexer.go:76:func1() [I] PID 154472: Initializing Issue Indexer: bleve
2024/05/28 17:04:10 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2024/05/28 17:04:10 ...xer/stats/indexer.go:87:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2024/05/28 17:04:10 ...s/actions/cleanup.go:36:cleanExpiredArtifacts() [I] Found 0 expired artifacts
2024/05/28 17:04:10 ...s/actions/cleanup.go:60:cleanNeedDeleteArtifacts() [I] Found 0 artifacts pending deletion
2024/05/28 17:04:10 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/05/28 17:04:10 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): http://localhost:3000/
2024/05/28 17:04:10 cmd/web.go:311:listen() [I] LFS server enabled
2024/05/28 17:04:10 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 154472
2024/05/28 17:04:10 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 103.8375ms

可以啊,gitea已经按照生成了新的data目录,且启动时需要的目录都指向了新目录 E:\git_rep_local_v1
去网页端看看 http://localhost:3000/
还是没看到自己在新目录的git库
用 sqlitestudio-3.3.3.zip 看看 gitea.db 哪里写了旧库的位置?
看了一圈,没找到,应该不在gitea.db中。如果在的话,那么在导入sql前的替换中,就能看到。
看了一圈,是不是硬写在E:\git_rep_local_v1\gitea-repositories\me\my_local_git_prj.git的文件中了。 这种可能性比较大。找一下。

FETCH_HEAD 中有硬写位置

在这里插入图片描述

073013986e5b302c20976d5978aae4e983ceeac5		branch 'master' of E:\git_rep_local\gitea-repositories\me\my_local_git_prj

改为

073013986e5b302c20976d5978aae4e983ceeac5		branch 'master' of E:\git_rep_local_v1\gitea-repositories\me\my_local_git_prj

又翻了翻,好像就这一处。

再运行 run_gitea.bat试试,启动正常。
去网页端看看 http://localhost:3000/, 还不行。
将data目录删掉,重新运行run_gitea.bat试试. 不行。
现在不知道gitea将旧仓库位置写在哪里了。

再查一下app.ini, 是否改漏了。

招了一下,还真改漏了。
这次搜索 E: 这2个字符

m1

[repository]
ROOT = E:/git_rep_local/gitea-repositories

改为

[repository]
ROOT = E:/git_rep_local_v1/gitea-repositories

m2

[log]
logger.router.MODE = console
LEVEL = info
ROOT_PATH = E:/git_rep_local/log

改为

[log]
logger.router.MODE = console
LEVEL = info
ROOT_PATH = E:/git_rep_local_v1/log

将 E:\git_rep_local_v1\app.ini 更新到 E:\git_rep_local_v1\custom\conf\app.ini
将 E:\git_rep_local_v1\data目录删了, 让gitea自动生成。
运行 run_gitea.bat, 启动信息正常。
访问网页 http://localhost:3000/, 不行,git库还是没有。

将 E:\git_rep_local_v1\data目录删了, 从备份gitea-dump-1716879579.zip中释放。
运行 run_gitea.bat, 启动信息正常。
访问网页 http://localhost:3000/, 不行,git库还是没有。
不过已经没有路径找不到的错误信息了。

总结

当前的gitea版本(gitea-1.22.0-gogit-windows-4.0-amd64.exe),只能将仓库恢复到另外一台计算机上的相同位置(包括本机的相同位置)。
那如果是windows的gitea库迁移到linux,那该着办呢?

看到gitea命令行还有针对单个库的备份和恢复,但是命令行不知道怎么用(总是报错)。

现在对gitea有点不放心了。改天再找找,需要将库备份和恢复的目录位置问题搞定才行。
这种git库的备份和恢复,怎么可以和具体的磁盘位置关联起来呢?这不科学啊。

用gitea备份/恢复库无解

官方资料说的和软件实际运行情况不一样,算了。
第三方的资料就更没说我遇到的这种细节。
gitea的这功能(备份/恢复)做的真磕碜。

折中的方法

先从已有gitea库克隆一个完整版本下来到目录dir_a。
在gitea服务端建立一个空库(库名和已经克隆下来的库名相同),这时可以得到库的克隆url_b.
在dir_a中右击,清空save的所有数据。将提交地址改成url_b.
然后在dir_a中,用TortoiseGit push到服务端的空库,等待完成。
此时,在随便一个本地空目录dir_c,克隆url_b, 等待完成。
此时,在dir_c中,右击,用TortoiseGit查看历史,可以看到该库的所有历史记录都有。说明克隆成功。
这种方法,折中的解决了gitea库的备份问题,且和gitea库的物理位置无关。

END

相关文章:

  • nacos连接异常did not find the Leader node;
  • JAVA应用服务器如何快速定位CPU问题
  • 【vue】@、@/、../和./的区别
  • apollo版本更新简要概述
  • 【机器学习】深入探索机器学习:利用机器学习探索股票价格预测的新路径
  • 现货白银的交易时间有多连贯?
  • 数据结构(六)队列
  • 计算机视觉与模式识别实验1-2 图像的形态学操作
  • PostgreSQL入门教程
  • 【算法】位运算算法——消失的两个数字(困难)
  • FinalShell无法连接Linux
  • 【论文导读】Grid Graph Reduction for Efficient Shortest Pathfinding(2023 Access)
  • 64位和32位对C++ 对long类型的使用造成程序崩溃、内存泄漏问题。
  • 鸿蒙ArkTS声明式开发:跨平台支持列表【显隐控制】 通用属性
  • 【Python爬虫--scrapy+selenium框架】超详细的Python爬虫scrapy+selenium框架学习笔记(保姆级别的,非常详细)
  • [PHP内核探索]PHP中的哈希表
  • “Material Design”设计规范在 ComponentOne For WinForm 的全新尝试!
  • 08.Android之View事件问题
  • 2017-08-04 前端日报
  • Effective Java 笔记(一)
  • js 实现textarea输入字数提示
  • python学习笔记 - ThreadLocal
  • Storybook 5.0正式发布:有史以来变化最大的版本\n
  • ⭐ Unity 开发bug —— 打包后shader失效或者bug (我这里用Shader做两张图片的合并发现了问题)
  • V4L2视频输入框架概述
  • 动态魔术使用DBMS_SQL
  • 回顾2016
  • 简单易用的leetcode开发测试工具(npm)
  • 利用阿里云 OSS 搭建私有 Docker 仓库
  • 前端面试之CSS3新特性
  • 前端设计模式
  • 腾讯视频格式如何转换成mp4 将下载的qlv文件转换成mp4的方法
  • 为物联网而生:高性能时间序列数据库HiTSDB商业化首发!
  • 移动端高清、多屏适配方案
  • (14)Hive调优——合并小文件
  • (js)循环条件满足时终止循环
  • (pojstep1.3.1)1017(构造法模拟)
  • (仿QQ聊天消息列表加载)wp7 listbox 列表项逐一加载的一种实现方式,以及加入渐显动画...
  • (附源码)计算机毕业设计SSM疫情社区管理系统
  • (剑指Offer)面试题41:和为s的连续正数序列
  • (六)Flink 窗口计算
  • (十)T检验-第一部分
  • (四)Controller接口控制器详解(三)
  • (完整代码)R语言中利用SVM-RFE机器学习算法筛选关键因子
  • (学习日记)2024.03.12:UCOSIII第十四节:时基列表
  • (已更新)关于Visual Studio 2019安装时VS installer无法下载文件,进度条为0,显示网络有问题的解决办法
  • (转)http协议
  • .bashrc在哪里,alias妙用
  • .mat 文件的加载与创建 矩阵变图像? ∈ Matlab 使用笔记
  • .net 4.0发布后不能正常显示图片问题
  • .NET 8 编写 LiteDB vs SQLite 数据库 CRUD 接口性能测试(准备篇)
  • .net core 的缓存方案
  • .NET之C#编程:懒汉模式的终结,单例模式的正确打开方式
  • @AutoConfigurationPackage的使用
  • @EventListener注解使用说明