[英]Cannot get git ls-remote list and no error at stdout
I'm executing git ls-remote ssh://git@git_repo:port *
in two different computers under same network, one Linux another Windows, and on Windows I'm getting the list but on Linux not. 我正在同一网络下的两台不同计算机(一个Linux另一个Windows)中执行
git ls-remote ssh://git@git_repo:port *
,在Windows上我正在获取列表,但在Linux上却没有。 No error at all just and empty list on Linux. 在Linux上,没有任何错误。
Both has the SSH key added to the remote repository and both are able to clone the repository. 两者都已将SSH密钥添加到远程存储库,并且都能够克隆存储库。
Update 1: 更新1:
Windows Git version: 2.19.2.windows.1
Windows Git版本:
2.19.2.windows.1
Linux Git version: 2.7.4
Linux Git版本:
2.7.4
Update 2: 更新2:
The repository is in Gerrit. 该存储库位于Gerrit中。
Update 3: 更新3:
I'm facing this problem using the Jenkins plugin Extended Choice Parameter plugin . 我使用Jenkins插件Extended Choice Parameter插件面临此问题。 It has no change since 2016. Any workaround for this would be also an answer.
自2016年以来没有任何变化。对此的任何变通办法也将是一个答案。
Any idea? 任何想法?
You probably should use: 您可能应该使用:
git ls-remote ssh://git@git_repo:port
without any suffix, as it defaults to listing everything. 没有任何后缀,因为它默认列出所有内容。
You can use: 您可以使用:
git ls-remote ssh://git@git_repo:port '*'
(or the same with double quotes—one or both of these may work on Windows as well). (或带双引号的情况相同-它们中的一个或两个也可以在Windows上运行)。 In a Unix/Linux-style command shell, the shell will replace
*
with a list of all the files in the current directory before running the command, unless you protect the asterisk from the shell. 在Unix / Linux风格的命令外壳程序中,除非您保护外壳中的星号,否则该外壳程序将在运行该命令之前将
*
替换为当前目录中所有文件的列表。
You can also use a single backlash: 您还可以使用单个反冲:
git ls-remote ssh://git@git_repo:port \*
as there are a lot of ways to protect individual characters from shells. 因为有很多方法可以保护单个字符不受shell影响。 The rules get a little complicated, but in general, single quotes are the "most powerful" quotes, while double quotes quote glob characters 1 but not other expansions.
规则有点复杂,但是通常,单引号是“功能最强大”的引号,而双引号则引出全局字符1 ,而其他扩展名则没有。 2 Backslashes quote the immediate next character if you're not already inside quotes (the behavior of backslash within double quotes varies in some shells).
2如果您还没有将引号括在引号中,则将其反引号引起来(在某些shell中,双引号内的反斜杠行为有所不同)。
1 The glob characters are *
, [
, and ?
1全局字符是
*
, [
和?
. 。 After
[
, characters inside the glob run to the closing ]
. 在
[
之后,全局内的字符一直到结尾]
。 So echo foo[abc]
looks for files named fooa
, foob
, and fooc
. 因此,
echo foo[abc]
查找名为fooa
, foob
和fooc
。 Note that .
注意
.
is generally not special: foo.*
matches only files whose names start with foo.
通常并不特殊:
foo.*
仅匹配名称以foo.
开头的文件foo.
, ie, including the period: a file named foo
does not start with foo.
,即包括句点:名为
foo
的文件不以foo
开头foo.
, only with foo
, and is not matched. ,仅与
foo
匹配,并且不匹配。
Globs are very different from regular expressions: in regular expressions, .
球形与正则表达式有很大不同:在正则表达式中,
.
matches any character (like ?
does in glob) and asterisk means "repeat previous match zero or more times", so that glob *
and regular-expression .*
are similar. 匹配任何字符(例如glob中的
?
),星号表示“将先前的匹配重复零次或多次”,因此glob *
和正则表达式.*
相似。 (In regular expression matches, we also need to consider whether the expression is anchored . Globs are always anchored so that the question does not arise.) (在正则表达式匹配中,我们还需要考虑表达式是否锚定 。全局对象始终锚定,这样就不会出现问题。)
2 Most expansions occur with dollar sign $
, as in $var
or ${var}
or $(subcommand)
, but backquotes also invoke command substitution, as in echo `echo bar`
. 2大多数扩展都以美元符号
$
,如$var
或${var}
或$(subcommand)
,但反引号也调用命令替换,如echo `echo bar`
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.