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). 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.
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. The rules get a little complicated, but in general, single quotes are the "most powerful" quotes, while double quotes quote glob characters1 but not other expansions.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).
1The glob characters are *
, [
, and ?
. After [
, characters inside the glob run to the closing ]
. So echo foo[abc]
looks for files named fooa
, foob
, and fooc
. Note that .
is generally not special: foo.*
matches only files whose names start with foo.
, i.e., including the period: a file named foo
does not start with foo.
, only with foo
, and is not matched.
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. (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.)
2Most expansions occur with dollar sign $
, as in $var
or ${var}
or $(subcommand)
, but backquotes also invoke command substitution, as in echo `echo bar`
.