git - 为什么git clone git ://is not working

标签 git github ssh

// This works
git clone https://github.com/foreverjs/forever.git

// This one also works
git clone git@github.com:foreverjs/forever.git

// This one didn't work
git clone git://github.com/foreverjs/forever.git

第三个的错误信息是:

Cloning into 'forever'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

据我所知,通过 SSH 或 HTTPS 的 git clone 比 git:// 协议(protocol)更受限制。我真的很困惑为什么我会收到此错误消息,因为 git:// 协议(protocol)甚至不需要身份验证。

github 现在只允许通过 SSH 或 HTTPS 进行 git clone 还是我在这里遗漏了什么?

最佳答案

我本地电脑的gitconfig文件导致了这个问题,我在~/.gitconfig文件中找到了如下两行:

[url "ssh://"]
    insteadOf = git://

如果我删除这两行,git://协议(protocol)将不会在 SSH 上运行,因此不会再有权限问题

关于git - 为什么git clone git ://is not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42220106/

相关文章:

git - 有没有办法将 pull 请求转回草稿 pull 请求?

regex - Github "Branch name pattern"否定

git - 如何通过 github rest api 将子模块更新为指定的提交?

git - 如何将开发分支 merge 到master中并忽略master中的更改?

git - 如何在 cherry-pick smartgit 上保留原作者

bash - Shell脚本-打开ssh连接并在需要时发送命令

git - 远程在 Git 服务器上创建一个裸仓库

ssh - Linux 上的 FileZilla, 'sftp' 命令无法连接到特定服务器。 SSH 工作,在 Windows 上一切正常

git - 即时更改 Git 用户

ruby - Git:无法运行 git 'rm -rf . --cached'