我正在尝试在我的服务器 (Oracle Linux 6) 上执行以下 git 命令:
git ls-remote -h https://<my-repo-path>.git
但它抛出以下错误:
error: The requested URL returned error: 501 Method Not Implemented while accessing https://<my-repo-path>.git/info/refs
Git 版本是 1.7.1,我无法将它更新到任何最新版本(除非我从源代码构建它,但此时我不愿意这样做)。有人可以帮忙吗?
最佳答案
错误不一定是 Git 错误,而是来自远程 HTTP 服务器的错误,它返回自定义错误消息(在 Git 本身中看不到):查看该服务器的日志可能会产生更多线索。
与此同时,如果可能,您可以尝试使用 SSH URL,前提是您可以在服务器端、管理这些 Git 存储库的帐户上注册您的公共(public) SSH key 。
然后这会起作用:git ls-remote <remoteAccount>@<server>:/path/to/git/repo
或者:如果 repo 与您正在执行命令的服务器位于同一服务器上,您可以直接使用它的路径:
git ls-remote -h /path/to/git/repo
但先升级仍然是一个不错的选择,OP saikat确认 in the comments :
Issue solved after upgrading the git version
关于git - 在 Oracle Linux 服务器上执行 git 命令时出错,返回错误代码 501,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54990253/