# Importing specific branch og git-repo using Pkg

**URL:** <https://discourse.julialang.org/t/importing-specific-branch-og-git-repo-using-pkg/127884>\
**Category:** New to Julia\
**Created:** [April 9, 2025, 12:01pm UTC](https://discourse.julialang.org/t/importing-specific-branch-og-git-repo-using-pkg/127884 "2025-04-09T12:01:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magnus\_Lilledahl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magnus_lilledahl/32/51079_2.png) [@Magnus\_Lilledahl](https://discourse.julialang.org/u/Magnus_Lilledahl)\
**Post date:** [April 9, 2025, 12:01pm UTC](https://discourse.julialang.org/t/importing-specific-branch-og-git-repo-using-pkg/127884/1 "2025-04-09T12:01:40Z")

</div>

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

```julia
...
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.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [April 9, 2025, 1:32pm UTC](https://discourse.julialang.org/t/importing-specific-branch-og-git-repo-using-pkg/127884/2 "2025-04-09T13:32:16Z")

</div>

It’s a Julia question.

```julia
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](https://github.com/JuliaLang/Pkg.jl/blob/bde7ce0392712e4cc16464fe1ee50cedbc43a6d4/src/REPLMode/argument_parsers.jl#L54-L81) can be improved.

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

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

```

---

<div class="post-metadata">

**Author:** ![Magnus\_Lilledahl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magnus_lilledahl/32/51079_2.png) [@Magnus\_Lilledahl](https://discourse.julialang.org/u/Magnus_Lilledahl)\
**Post date:** [April 9, 2025, 1:46pm UTC](https://discourse.julialang.org/t/importing-specific-branch-og-git-repo-using-pkg/127884/3 "2025-04-09T13:46:39Z")

</div>

Aah, of course. Thank you very much.
