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\bin

E:\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\bin

E:\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\bin

E:\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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/660438.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

pytorch深度学习-环境搭建-2

1.1下载cudnn,解压 1.2.找到本级cuda安装路径 1.3.刚才解压文件复制到cuda安装目录 2.1 安装pytouch conda install pytorch torchvision torchaudio pytorch-cuda12.1 -c pytorch -c nvidia 3.pytouch验证 我这儿是有问题的 PS C:\Users\Administrator\PycharmProjects\pyth…

BGP路由策略实验

一、实验拓扑 二、IP分配(骨干) R1&#xff1a; 0/0/0 15.0.0.1 24 0/0/1 18.0.0.2 24 0/0/2 19.0.0.1 24 R2: 0/0/0 16.0.0.1 24 0/0/1 15.0.0.2 24 R3: 0/0/0 17.0.0.2 24 0/0/1 18.0.0.1 24 R4: 0/0/0 16.0…

怎么将3D模型转换立面图---模大狮模型网

在建筑设计、室内设计以及产品建模等领域&#xff0c;经常需要将3D模型转换为立面图以进行展示、分析或交流。立面图能够清晰地呈现物体的外观和结构&#xff0c;是设计和施工中不可或缺的一部分。 一、导出3D模型 首先&#xff0c;需要将3D模型导出为CAD软件能够识别的格式。…

零基础学习图生图

目录 一、图生图是什么二、安装秋叶整合包2.1 秋叶包安装2.2 秋叶包拓展安装&#xff1a;2.3 ckpt配置&#xff1a;2.4 界面常用功能配置&#xff1a; 三、图生图基本功能展示3.1 图生图的界面3.2 重要的参数设置&#xff1a;3.3 涂鸦功能3.4 局部重绘功能3.5 涂鸦重绘3.6 上传…

microk8s 报错tls: failed to verify certificate: x509:

问题&#xff1a; ssh命令出现如下图所示 输入任何microk8s的容器命令几乎都是x509报错 kubectl get pods -ALL 原因&#xff1a; 证书过期 相关文档&#xff1a; MicroK8s - 服务和端口 Microk8S v1.24 - refresh-certs 似乎无法刷新证书 问题 #3241 规范/microk8s Git…

二叉树介绍及堆

文章目录 树 概念及结构 二叉树 概念及结构 特殊的二叉树 完全二叉树 满二叉树 性质 储存 顺序存储 链式储存 堆 概念及结构 小堆 大堆 建堆 向上调整建堆 向下调整建堆 TOPK问题 法一&#xff1a; 法二&#xff1a; 树 概念及结构 树是一种非线性的数据…

[图解]企业应用架构模式2024新译本讲解02-表数据入口

1 00:00:00,420 --> 00:00:04,330 这个案例&#xff0c;我们就是用书上的案例了 2 00:00:06,080 --> 00:00:08,860 收入确认的一个案例 3 00:00:09,510 --> 00:00:11,100 书上讲了&#xff0c;收入确认 4 00:00:13,330 --> 00:00:15,270 就是说&#xff0c;你给…

5月岚庭工人大会“安全就是效率、形象即是品质”

2024年5月18日、19日岚庭一月一期的“产业工人大会”和“工程大会”圆满举行初夏正当时&#xff0c;此次大会主要围绕“安全”与“形象”展开六场专题培训只为精益求精产业工人和装修管家全体到场。 岚庭 以绝对【安全】护家护园 安全就是生命&#xff0c;违章就是事故&#x…

Javaweb基础之Filter

大家好&#xff0c;这里是教授.F 引入&#xff1a; 为什么需要过滤器&#xff1f;&#xff1f;&#xff1f;我们在访问一个项目的时候&#xff0c;常常有很多页面&#xff0c;如果没有过滤器&#xff0c;则我们需要在用户访问一个页面的时候&#xff0c;都要进行一个校验&…

OrangePi AIpro 快速上手初体验——接口、样例和目标检测

​ 一、 开发板简介 OrangePi AIpro开发板是香橙派联合华为精心打造的高性能 AI 开发板&#xff0c;其搭载了昇腾 AI 处理器&#xff0c;可提供 8TOPS INT8 的计算能力&#xff0c;内存提供了 8GB 和 16GB两种版本。可以实现图像、视频等多种数据分析与推理计算&#xff0c;可…

合约之间调用-如何实现函数静态调用?

合约之间的函数调用 EOA&#xff0c;external owned account&#xff0c;外部账号&#xff0c;例如metamask调用最终总是由EOA发起的合约之间的调用使得一次完整的调用成为一个调用链条 合约间调用过程 调用者须持有被调用合约的地址得到被调用合约的信息将地址重载为被调用合…

母亲的爱与妻子的爱,同为“爱“。不同感受!

母亲的爱与妻子的爱&#xff0c;虽然都是一个女人给予男人的爱&#xff0c;却有着本质的不同&#xff01; 天下父母对儿女的爱大多相同。在母亲眼中&#xff0c;儿女无论是多大年龄&#xff0c;无论你是否长大成人&#xff0c;也无论你做多大的官&#xff0c;有多么大的成就&am…

【深度学习】吸烟行为检测软件系统

往期文章列表&#xff1a; 【YOLO深度学习系列】图像分类、物体检测、实例分割、物体追踪、姿态估计、定向边框检测演示系统【含源码】【深度学习】YOLOV8数据标注及模型训练方法整体流程介绍及演示【深度学习】行人跌倒行为检测软件系统【深度学习】火灾检测软件系统【深度学…

KDD 2024|基于隐空间因果推断的微服务系统根因定位

简介&#xff1a;本文介绍了由清华大学、南开大学、eBay、微软、中国科学院计算机网络信息中心等单位共同合作的论文《基于隐空间因果推断的受限可观测性场景的微服务系统根因定位》。该论文已被KDD 2024会议录用。 论文标题&#xff1a;Microservice Root Cause Analysis Wit…

数据与结构——红黑树

目录 红黑树的概念 性质 结点的定义 插入 验证 查找 删除 红黑树与AVL树的比较 红黑树的概念 红黑树是一种自平衡二叉搜索树&#xff08;Binary Search Tree, BST&#xff09;&#xff0c;其每个节点带有颜色属性&#xff0c;可以是红色或黑色。红黑树通过约束节点颜色…

盲盒小程序开发,为市场带来的新机遇

近年来&#xff0c;盲盒市场一直处于热门行业中&#xff0c;发展非常快速。在互联网的支持下&#xff0c;也衍生出了线上盲盒小程序&#xff0c;实现了线上线下双发展的态势。 盲盒小程序作为一种新的盲盒购物方式&#xff0c;受到了盲盒消费者的喜爱&#xff0c;为盲盒行业的…

Matlab 结构光相移法(单频多相)

文章目录 一、简介1、基于点的测距2、基于条纹的测距二、条纹编码2.1 二进制编码2.2相移法三、实现代码参考文献一、简介 在介绍相移法之前,我们需要先了解一下为啥会有相移法,了解了其来龙去脉,则更容易去应用它。 1、基于点的测距 首先我们从点的测距开始,这有点类似于立…

香港优才计划找中介是否是智商税,靠谱中介又该如何找?

关于香港优才计划的申请&#xff0c;找中介帮助还是自己DIY&#xff0c;网络上充斥的声音太多&#xff0c;对不了解的人来说&#xff0c;难以抉择的同时还怕上当受骗。 这其中很容易误导人的关键在于——信息差&#xff01; 今天这篇文章的目的就是想让大家看清一些中介和DIY…

2024-05-29 blue-VH-driver-对外接口的并行调用-设计与思考

摘要: VH的driver的对外接口, 要做到可以并行&#xff0c;也就是两个不同的线程&#xff0c;分别调用&#xff0c;不能互相阻塞。 本文记录对其的思考和设计。 上下文: 2024-05-28 blue-VH-driver-需求分析及问题分析-CSDN博客 2024-05-27 blue-vh-问题点-CSDN博客 2024-05…