赞
踩
最近使用gitea好像老是有bug,所以我就想更新一下公司的git服务器(从1.12更新到1.17),当我更新完成后,无法启动提示git需要2.0以上版本,无赖centos的yum最高只能安装到git 1.8.3,所以就采用啦网络上大佬的下载源码编译方案,但是当我编译安装(当然我是先卸载啦老版本,否在依然会提示git版本为1.8.3版本太低)完成后重启gitea却提示从$PATH中找不到git命令,几番折腾最后还是解决啦,这里将我的解决方案分享给大家。
更新git方案参考:https://blog.csdn.net/lixiaomei0623/article/details/121361571
$git --version
git version 2.32.0
能输出对应版本号,也重启过操作系统了,证明$PATH是一定更新了的。但是重启gitea依然报$PATH中找不到git可执行文件。
2023/06/13 16:43:05 routers/init.go:66:mustInitCtx() [F] code.gitea.io/gitea/modules/git.InitOnceWithSync(ctx) failed: git not found: exec: "git": executable file not found in $PATH
2023/06/13 16:43:15 cmd/web.go:106:runWeb() [I] Starting Gitea on PID: 5760
2023/06/13 16:43:15 ...s/setting/setting.go:594:deprecatedSetting() [E] Deprecated fallback `[server]` `LFS_CONTENT_PATH` present. Use `[lfs]` `PATH` instead. This fallback will be removed in v1.18.0
2023/06/13 16:43:15 cmd/web.go:157:runWeb() [I] Global init
2023/06/13 16:43:15 ...s/setting/setting.go:594:deprecatedSetting() [E] Deprecated fallback `[server]` `LFS_CONTENT_PATH` present. Use `[lfs]` `PATH` instead. This fallback will be removed in v1.18.0
2023/06/13 16:43:15 routers/init.go:66:mustInitCtx() [F] code.gitea.io/gitea/modules/git.InitOnceWithSync(ctx) failed: git not found: exec: "git": executable file not found in $PATH
ln -s /usr/local/git/bin/git /usr/bin/
报错如下
Gitea: Internal error
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
道理和上面一样的,是因为git用户的$PATH下找不到git-upload-pack命令导致的,参考解决方案:
https://blog.csdn.net/Smart_look/article/details/118061090
解决方案:
ln -s /usr/local/git/bin/git-upload-pack /bin/git-upload-pack
ln -s /usr/local/git/bin/git-cvsserver /bin/git-cvsserver
ln -s /usr/local/git/bin/gitk /bin/gitk
ln -s /usr/local/git/bin/git-receive-pack /bin/git-receive-pack
ln -s /usr/local/git/bin/git-shell /bin/git-shell
ln -s /usr/local/git/bin/git-upload-archive /bin/git-upload-archive
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。