git - 在 Oracle Linux 服务器上执行 git 命令时出错,返回错误代码 501

标签 git http oraclelinux

我正在尝试在我的服务器 (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/

相关文章:

tomcat - logrotate 不旋转 catalina.out

git - 支持 GIT 的 PL/SQL IDE

Git sparse checkout 只支持 repo 根目录下的文件夹?

http - 刚刚获得了 SSL 证书,但仍然存在不安全的本地主机镜像

amazon-web-services - 我无法安装 Amazon Inspector

linux - 在aarch64 Linux中安装anaconda

git - 您可以从 GitHub 上的命令行发出 pull 请求吗?

git - "not something we can merge"是怎么产生的?

node.js - 空 req.body 接收到 node.js 的文本/纯 POST 请求

java - 尝试使用 Java 发布时出现 HTTP 500 错误