Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SSH列出Git存储库时遇到问题_Git_Ssh - Fatal编程技术网

使用SSH列出Git存储库时遇到问题

使用SSH列出Git存储库时遇到问题,git,ssh,Git,Ssh,我在使用SSH列出Git存储库时遇到问题 $ git ls-remote -h ssh://<user>@<server.com>/repos/GitTest 但是,如果我通过Windows共享UNC路径对同一存储库运行相同的命令,它工作正常,请参见以下内容: $ git ls-remote -h //<server.com>/Users/<user>/repos/GitTest b2f52213aac6e8c178c96860d96ad7da

我在使用SSH列出Git存储库时遇到问题

$ git ls-remote -h ssh://<user>@<server.com>/repos/GitTest
但是,如果我通过Windows共享UNC路径对同一存储库运行相同的命令,它工作正常,请参见以下内容:

$ git ls-remote -h //<server.com>/Users/<user>/repos/GitTest

b2f52213aac6e8c178c96860d96ad7da06733ddf        refs/heads/master
$git ls remote-h///Users//repos/GitTest
b2f52213aac6e8c178c96860d96ad7da06733ddf参考/头/主

有什么想法吗?

正如@GenoChen所指出的,这只是由于URL本身的语法错误(SSH域名和路径之间的分隔符应该是
,而不是
/

你能试试这个吗

git ls-remote -h <user>@<server.com>:repos/GitTest
git ls remote-h@:repos/GitTest
作为记录,Git接受的不同类型的URL在中进行了描述。

因为您使用的是SSH,您对该repo具有正确的权限吗?是的,我正在验证的用户对SSH服务器的主目录具有完全的Windows权限。很抱歉,错误日志没有查看。我认为这是由于SSH-URL格式的错误造成的。我总是从图片中完全去掉Git来引发类似的问题:确保
SSHuser@host例如,ls-repos
是有效的。(如果服务器是Windows,请将
ls repos
替换为任何Windows等效项。)确定-这验证命令行ssh是否工作。因此,您的Git必须使用其他ssh或错误地调用ssh。下一步是
GIT\u TRACE=1 GIT ls remote…
,它将向您展示GIT是如何尝试调用ssh的。我感谢大家迄今为止的投入!不幸的是,问题仍然存在:$git ls remote@:repos/GitTest@的密码:致命:“”repos/GitTest“”似乎不是git存储库致命:无法从远程存储库读取。请确保您具有正确的访问权限,并且存储库存在。好的。。。所以我怀疑这是一个路径问题。也许git-ls-remote-h@:repos/GitTest/.git应该可以。。。否则请执行
sshuser@server.com
并仔细检查.git repo的绝对路径…
仅在类似scp的URL中是分隔符。在
ssh://
url中,分隔符是
/
ssh://[user@]host.xz/path/to/repo
git ls-remote -h <user>@<server.com>:repos/GitTest