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

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/22408.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/22408.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/22408.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

容器中運行ip addr提示bash: ip: command not found【筆記】

容器中運行ip addr提示bash: ip: command not found 原因沒有安裝ip命令。 rootdocker-desktop:/# ip addr bash: ip: command not found rootdocker-desktop:/# apt-get install -y iproute2

谷歌廣告怎么開戶?Google推廣開戶費用、代運營流程、代理開戶、投放價格

谷歌推廣&#xff08;Google Ads廣告&#xff09;是指Google公司面向全球用戶&#xff0c;在其自有搜索引擎、YouTube視頻、Gmail郵箱等各類自有產品提供的廣告位中&#xff0c;展示的各類互聯網廣告。谷歌廣告&#xff0c;有很多種衍生的叫法&#xff1a;谷歌SEM、谷歌競價、谷…

渦輪流量傳感器

渦輪流量傳感器是一種精密的流量測量儀表&#xff0c;廣泛應用于石油、化工、冶金、科研等領域的計量和控制系統。配備有衛生接頭的渦輪流量傳感器還可以應用于制藥行業。該傳感器的主要工作原理基于流體動力學和電磁感應原理&#xff0c;當流體流經傳感器時&#xff0c;流體的…

cron表達式的講解及其在若依定時任務中的使用

目錄 前言介紹一 cron的結構二 各域的含義三 常用cron表達式 實例1 后臺添加定時任務處理類2 前端新建定時任務信息3 點擊執行一次4 啟動定時任務 前言 在實際項目開發中Web應用有一類不可缺少的&#xff0c;那就是定時任務。 定時任務的場景可以說非常廣泛&#xff0c;比如某…

JS跨頁面或跨JS文件對變量賦值

JS跨頁面或跨JS文件對變量賦值&#xff0c;這是很小的一個問題。 但問題雖小&#xff0c;卻總覺得有點不夠自然&#xff0c;不爽。 為什么呢&#xff1f;訪問一個頁面上的變量不是什么難事&#xff0c;比如用parent.變量名&#xff0c;或者windows名.變量名&#xff0c;都可以…

Day42 代碼隨想錄打卡|二叉樹篇---二叉樹的所有路徑

題目&#xff08;leecode T257&#xff09;&#xff1a; 給你一個二叉樹的根節點 root &#xff0c;按 任意順序 &#xff0c;返回所有從根節點到葉子節點的路徑。 葉子節點 是指沒有子節點的節點。 方法&#xff1a;本題需要對二叉樹中的所有路徑進行遍歷&#xff0c;并且是…

vue-router 源碼分析——2. router-link 組件是如何實現導航的

這是對vue-router 3 版本的源碼分析。 本次分析會按以下方法進行&#xff1a; 按官網的使用文檔順序&#xff0c;圍繞著某一功能點進行分析。這樣不僅能學習優秀的項目源碼&#xff0c;更能加深對項目的某個功能是如何實現的理解。這個對自己的技能提升&#xff0c;甚至面試時…

CSS選擇器和樣式

CSS CSS&#xff1a;選擇器&#xff1a;通配符選擇器&#xff1a;基本選擇器&#xff1a;標簽選擇器&#xff1a;類選擇器&#xff1a;ID選擇器&#xff1a;基本選擇器的優先級別: 群組選擇器:派生選擇器&#xff1a;后代選擇器&#xff1a;子代選擇器&#xff1a;相鄰兄弟選擇…

sed批量修改shell腳本內容

需求:郵件服務器腳本ip做了切換,由原先的11.22.33.44,切換為11.22.33.55 需要把所有使用了11.22.33.44該ip的腳本改為11.22.33.55 示例: #建2個測試文件 cat test1.txt 11.22.33.44 hello 11.22.33.44cat test2.txt 11.22.33.44 world#1.先找出哪些腳本包含該ip grep 11.22.3…

正邦科技(day3)

出廠測試 設備校準 這個需要注意的是校準電流、電壓、電感的時候有時候負感器會裝反&#xff0c;mcu會壞&#xff0c;需要flash一下清空內存

【貓狗識別系統】圖像識別Python+TensorFlow+卷積神經網絡算法+人工智能深度學習

貓狗識別系統。通過TensorFlow搭建MobileNetV2輕量級卷積神經算法網絡模型&#xff0c;通過對貓狗的圖片數據集進行訓練&#xff0c;得到一個進度較高的H5格式的模型文件。然后使用Django框架搭建了一個Web網頁端可視化操作界面。實現用戶上傳一張圖片識別其名稱。 一、前言 …

iptables備份

備份 iptables sudo iptables-save > iptables_backup.txt文件還原

【安裝筆記-20240529-Windows-poedit 翻譯編輯器】

安裝筆記-系列文章目錄 安裝筆記-20240529-Windows-Poedit 翻譯編輯器 文章目錄 安裝筆記-系列文章目錄安裝筆記-20240529-Windows-Poedit 翻譯編輯器 前言一、軟件介紹名稱&#xff1a;Poedit主頁官方介紹 二、安裝步驟測試版本&#xff1a;Poedit-3.4.4下載鏈接安裝界面 三、…

華為機械工程師面試問題

在機械工程師的面試中,面試官可能會提出一系列問題,以評估應聘者的專業知識、技能、經驗以及解決問題的能力。以下是一些可能的面試題: 基礎知識與技能: 請解釋機械工程中常用的幾種傳動方式,并比較它們的優缺點。描述一下你在機械設計過程中常用的軟件,并舉例說明你是如…

網絡安全設備常見部署模式介紹

文章目錄 前言串聯模式路由模式透明模式 旁路模式旁路監聽代理模式正向代理透明代理反向代理 前言 網絡安全設備主要有串聯模式和旁路模式。這些模式在網絡安全架構中扮演著關鍵角色&#xff0c;以確保數據傳輸的安全性和高效性。 串聯模式 串聯模式要求所有流量都必須通過安…

程序員為什么會成為工具人——及其一些破局的思考

一、程序員為什么會成為工具人 程序員為什么會成為工具人的因素分析 序號因素分析1 技術從來不是解決用戶價值問題的那個人&#xff0c;產品才是解決用戶需求痛點創造價值問題的那個人 &#xff08;技術只是服務于產品的工具&#xff0c;程序員永遠都是在做最后一公里的搬磚&am…

Linux 命令 find 的深度解析與使用

Linux 命令 find 的深度解析與使用 在 Linux 系統中&#xff0c;find 命令是一個功能強大的工具&#xff0c;用于在文件系統中搜索文件或目錄。無論是基于文件名、文件類型、文件大小、文件權限&#xff0c;還是基于文件的最后修改時間等&#xff0c;find 命令都能提供靈活的搜…

Windows家庭版 WSL2非C盤詳細安裝配置與WSL代理設置+WSL基礎環境CUDA安裝

1 WSL2 配置 1.1 WSL 開啟 注意&#xff1a;需要在windows功能中開啟“Hyper-V”和“適用于Linux的Windows子系統”功能 但是&#xff01;windows家庭版&#xff08;windows home&#xff09;是默認沒有Hyper-V功能的&#xff0c;自己手動安裝&#xff1a; 創建一個記事本&a…

前端面試寶典總結4-手搓代碼JavaScript(基礎版)

前端面試寶典總結4之手寫代碼JavaScript&#xff08;基礎版&#xff09; 本文章 對各大學習技術論壇知識點&#xff0c;進行總結、歸納自用學習&#xff0c;共勉&#x1f64f; 上一篇&#x1f449;: 前端面試寶典總結4-手搓代碼JavaScript&#xff08;數據處理&#xff09; 文…

R語言學習 - 柱狀圖

柱狀圖繪制 柱狀圖也是較為常見的一種數據展示方式&#xff0c;可以展示基因的表達量&#xff0c;也可以展示GO富集分析結果&#xff0c;基因注釋數據等。這篇轉錄組工具比較 轉錄組分析工具哪家強&#xff1f;中就使用到比較多堆積柱狀圖。 常規矩陣柱狀圖繪制 有如下4個基…