Git 克隆“致命:我不处理协议‘ssh’”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22566611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:52:44  来源:igfitidea点击:

Git clone "fatal: I don't handle protocol 'ssh'"

gitunixssh

提问by igorsantos07

I've created a repository in my local machine and asked a colleague to clone it, but it's saying it can't handle the SSH protocol. In my computer the repository is at /devel/scripts.git, and there's an user called develwith access to that folder. Another guy could clone it normally, using git clone ssh://[email protected]/devel/scripts.git.

我在我的本地机器上创建了一个存储库,并要求一位同事克隆它,但它说它无法处理 SSH 协议。在我的计算机中,存储库位于/devel/scripts.git,并且有一个用户devel可以访问该文件夹。另一个人可以正常克隆它,使用git clone ssh://[email protected]/devel/scripts.git.

We are all using Ubuntu, me and the problematic machine are at 12.04 (I could push from another folder using the same URL as remote) and the other guy is using 13.04.

我们都在使用 Ubuntu,我和有问题的机器在 12.04(我可以使用与远程相同的 URL 从另一个文件夹推送)而另一个人正在使用 13.04。

Finally, the machine that got the issue can access that user via SSH normally.

最后,出现问题的机器可以通过SSH正常访问该用户。

回答by wytten

Look at the url in .git/config, in my case there were control characters in the protocol portion. These were not made visible when git generated its error message.

查看 .git/config 中的 url,在我的情况下,协议部分中有控制字符。当 git 生成错误消息时,这些不可见。

When copy/pasting the error message to another place, the control characters might show up:

将错误消息复制/粘贴到另一个位置时,可能会显示控制字符:

enter image description here

在此处输入图片说明

回答by digitil

I faced the same issue on Windows in Cygwin and was able to get around the error by changing the protocol to 'git+ssh'.

我在 Cygwin 的 Windows 上遇到了同样的问题,并且能够通过将协议更改为“git+ssh”来解决该错误。

git clone git+ssh://[email protected]/devel/scripts.git

回答by Aditya Batheja

A way around this is explicitly mentioning the address by using quotes. Instead of using: git clone ssh://[email protected]/devel/scripts.git

解决此问题的一种方法是使用引号明确提及地址。而不是使用: git clone ssh://[email protected]/devel/scripts.git

Try: git clone 'ssh://[email protected]/devel/scripts.git'

尝试: git clone 'ssh://[email protected]/devel/scripts.git'

回答by Rijo

I had similar issue when trying from windows Git GUI. I executed the command via Git Bashand it worked for me without this error.

从 windows Git GUI尝试时,我遇到了类似的问题。我通过Git Bash执行了命令,它对我有用,没有出现这个错误。