EUNBORNBRANCH error when adding private package

We’ve been using the package manager heavily ever since 1.0, with a dedicated private git server that contains bare git repos. Everything has always worked fine, but suddenly I find myself unable to add one of our packages:

pkg> add git://git/MyProject
  Updating git-repo `git://git/MyProject`
ERROR: GitError(Code:EUNBORNBRANCH, Class:Reference, reference 'refs/heads/master' not found)
 [1] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/LibGit2/src/error.jl:101 [inlined]
 [2] head(::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/LibGit2/src/reference.jl:44
 [3] branch(::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/LibGit2/src/LibGit2.jl:368
 [4] (::getfield(Pkg.Types, Symbol("##83#86")))(::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:622
 [5] with(::getfield(Pkg.Types, Symbol("##83#86")), ::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/LibGit2/src/types.jl:1125
 [6] guess_rev(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:621
 [7] resolve_repo_add!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:691
 [8] handle_repo_add!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:706
 [9] handle_repos_add!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:725
 [10] #add#25(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.add), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:87

That package has been added/updated lots of times without issue. Other packages have no such problem. Adding the package in a fresh environment causes the same issue. I can git clone the repo just fine. And the refs/heads/master file definitely exists on the git server. Does anyone have any idea? pkg> gc didn’t help either.

Also: it works on a Windows machine, but not on Linux. Julia 1.2.0

I’m assuming it works when you git clone git://git/MyProject from the command line?

Probably something similar to [SOLVED] Unable to use local package, i.e. the package got added when it didn’t have any commits at all and got borken. Try rm -rf .julia/clones.

Ideally Pkg should detect this and not cache a borken state of the repo.


Yes, it does.

That’s a 1.5 year old package, that predates Julia 1.0, so I don’t think that would be the case. rm -rf .julia/clones fixed the issue in any case, thank you!

1 Like