Gogs的官網地址:https://gogs.io/docs/installation/install_from_binary
安裝教程,分為裸機和docker兩種方式,建議裸機方式使用linux的git用戶進行安裝【docker安裝的忽略】
安裝完畢之后如果想要重新初始化設置,只需要刪除/home/git/gogs/custom/conf/app.ini 這個文件,重新啟動./gogs web即可,倉庫以及用戶信息等保留。
剩下就是裸機安裝過程中,為了使用ssh方式進行git clone所做的踩坑,
第一個配置完ssh免密登錄之后還需要進行密碼驗證,建議檢查一下git用戶家目錄,.ssh目錄,以及authorized_keys文件的權限設置是否合理,具體參閱這篇博文解決SSH免密登錄配置成功后不生效問題,
然后設置完之后可能會發現ssh –T user@host能夠校驗正確了,但是還是Git clone不下來,且git報錯
$ git clone xxxxxxxxxxxxxxxxxxxx Cloning into 'xxxxx' Gogs: Internal error fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
可能以為是ssh和權限相關設置不對導致,建議看下/home/git/gogs/log/hooks/serv.log 這個文件,如果里面出現類似報錯
2021/09/08 18:50:01 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH 2021/09/08 19:03:46 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH 2021/09/08 19:03:50 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH 2021/09/08 19:08:50 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH 2021/09/08 19:18:10 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH
可以參考這篇文章
gogs倉庫管理軟件 exec: "git-upload-pack": executable file not found in $PATH
這兩個坑處理完畢之后基本就能正常使用了,剩下可能就是想要設置開機自啟動,可以參考這幾篇文章
https://www.jianshu.com/p/c9ca7c16bd1f,https://www.codenong.com/cs109129829/
后者還提供了app.ini各種配置參數的詳解,有興趣可以了解一下.
一般復制過去就行了,如果啟動發現日志里面還是有類似 not found in $PATH 這種問題,可以把git相關的命令做軟連接到/sbin目錄下試試。