3

I am following this tutorial to learn Julia and the idea is to add a Github repository to Julia:

pkg> add https://github.com/BenLauwens/ThinkJulia.jl

Unfortunately, it outputs a long error:

(v1.1) pkg> add https://github.com/BenLauwens/ThinkJulia.jl
  Updating git-repo `https://github.com/BenLauwens/ThinkJulia.jl`
ERROR: GitError(Code:ERROR, Class:Config, failed to map '--help')
Stacktrace:
 [1] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/LibGit2/src/error.jl:101 [inlined]
 [2] #checkout_tree#46(::LibGit2.CheckoutOptions, ::Function, ::LibGit2.GitRepo, ::LibGit2.GitTree) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/LibGit2/src/repository.jl:358
 [3] #checkout_tree at ./none:0 [inlined]
 [4] macro expansion at ./gcutils.jl:87 [inlined]
 [5] (::getfield(Pkg.Types, Symbol("##62#63")))(::LibGit2.GitTree) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:780
 [6] with(::getfield(Pkg.Types, Symbol("##62#63")), ::LibGit2.GitTree) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/LibGit2/src/types.jl:1125
 [7] #handle_repos_add!#61(::Bool, ::Nothing, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:760
 [8] #handle_repos_add! at ./none:0 [inlined]
 [9] #add_or_develop#17(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:47
 [10] (::getfield(Pkg.API, Symbol("#kw##add_or_develop")))(::NamedTuple{(:mode,),Tuple{Symbol}}, ::typeof(Pkg.API.add_or_develop), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at ./none:0
 [11] do_add!(::Dict{Symbol,Any}, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Symbol,Any}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:672
 [12] #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:742
 [13] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:741
 [14] do_cmd!(::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:563
 [15] #do_cmd#31(::Bool, ::Function, ::REPL.LineEditREPL, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:538
 [16] do_cmd at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:534 [inlined]
 [17] (::getfield(Pkg.REPLMode, Symbol("##53#56")){REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:988
 [18] #invokelatest#1 at ./essentials.jl:742 [inlined]
 [19] invokelatest at ./essentials.jl:741 [inlined]
 [20] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
 [21] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
 [22] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
 [23] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
 [24] #invokelatest#1 at ./essentials.jl:742 [inlined]
 [25] invokelatest at ./essentials.jl:741 [inlined]
 [26] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
 [27] exec_options(::Base.JLOptions) at ./client.jl:284
 [28] _start() at ./client.jl:436

I don't understand why I am getting this error, so I would like to know any solution to this. By the way, I am using Julia 1.1 and I am using Ubuntu 16.04 LTS.

sophros
  • 14,672
  • 11
  • 46
  • 75
David
  • 435
  • 3
  • 12

2 Answers2

2

Do you have git installed in your system? Which OS are you running? Have a look at the git website on how to install it for different OS's.

Try running the command Pkg.Status() and see if you find anything meaningful. If you do so, I recommend checking as well the location JULIA_PKGDIR and removing the whole folder/git repo you 're trying to install.

As a last option you can create a new Julia home. In order to do so:

  1. backup of your current home folder
  2. delete your julia home (.julia in Unix-based systems)
  3. run Pkg.init
  4. Copy your old REQUIRE file to your new home
  5. run Pkg.update
  6. copy old packages to the new home as needed

Good luck!

wizofe
  • 494
  • 7
  • 19
  • I have `git` 2.22.1. By the way, are you sure your instructions are for Julia 1.1? `Pkg.init` doesn't work in Julia 1.1, `JULIA_PKGDIR` is not a thing in Julia 1.1, the command should be `Pkg.status()`. Anyway... I have followed your instructions and I still have the problem. – David Aug 14 '19 at 21:21
  • Which OS are you running? Try `Pkg.update()`. What do you get? – wizofe Aug 14 '19 at 22:19
  • I have Ubuntu 16.04 and after Pkg.update(), I get: ```Cloning default registries into `~/.julia` Cloning registry from "https://github.com/JuliaRegistries/General.git" ERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:Config, failed to map '--help') ``` – David Aug 14 '19 at 22:49
  • What happens if you try `git clone https://github.com/JuliaRegistries/General.git` from the command line? – wizofe Aug 14 '19 at 23:41
  • Now I understand my problem, it was something related to `git`. I have added my answer to show why. – David Aug 17 '19 at 04:15
2

Ok, so the problem is related to some configuration with git. If you try:

git clone https://github.com/JuliaRegistries/General.git

it shows an error:

Clonando en 'General'...
fatal: mal valor de config numérica '--help' para 'core.autocrlf': unidad inválida

which translates to:

Cloning 'General'
fatal: bad numeric config value 'auto' for 'core.autocrlf

Following this answer, I wrote in the terminal:

git config --global --replace-all core.autocrlf false

and problem solved. Now I can add repositories and packages to Julia.

David
  • 435
  • 3
  • 12
  • I would appreciate if you mark my answer as helpful, as I located the problem in your `git` :) Ta – wizofe Aug 18 '19 at 16:24
  • This command 'git config --global --replace-all core.autocrlf false' worked for me – Vinod Jul 25 '21 at 02:42