Importing specific branch og git-repo using Pkg

I tried to add a specific branch of a package repo using the #-syntax described in the documentation like

Pkg add "git@gitlab.restofpath.git#dev"

But get the response

...
remote:
remote: The namespace you were looking for could not be found.
remote:
...
ERROR: The command `git clone --quiet 'git@gitlab.restofpath.git#dev'
...

(The ellipses are just some more error text and I have changed the name of the actual repo with restofpath)

If run the command git clone --quiet 'git@gitlab.restofpath.git#dev directly in the terminal I get the same first part of the error message.

If I instead do
julia> Pkg.add(url = "git@gitlab.restofpath.git", rev = "dev")

everything works hunky-dory.

Any idea why the #-syntax is not working? (not sure if this is a Git or Julia question). I am sitting on a windows machine if that is important.

It’s a Julia question.

ERROR: The command `git clone --quiet 'git@gitlab.restofpath.git#dev'

The #dev part is not valid to send to git and should have been stripped off if the parsing had worked as intended. The canonical solution to such problems is to use Pkg.add directly, as you did, where you can exactly specify your intent without the intervention of parsing heuristics.

Solving the parsing problem is a matter of finding out how this regex can be improved.

However, in this case I think you might have better luck if you modify your quoting slightly. Try

pkg> add "git@gitlab.restofpath.git"#dev

Aah, of course. Thank you very much.