# Julia fails to handle properly the Git meta credential helper

**URL:** <https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928>\
**Category:** General Usage\
**Created:** [August 18, 2022, 2:00pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928 "2022-08-18T14:00:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 18, 2022, 2:00pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/1 "2022-08-18T14:00:25Z")

</div>

Julia 1.8 on Windows fails to handle properly the Git meta credential helper. In `.gitconfig`:

```julia
[credential "helperselector"]
	selected = <no helper>

```

Introduced in Git for Windows v2.23.0.

I wonder if Julia is being tested with this newest Git?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 18, 2022, 4:43pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/2 "2022-08-18T16:43:21Z")

</div>

The package manager uses libgit2 for git functionality.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 18, 2022, 6:10pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/3 "2022-08-18T18:10:56Z")

</div>

It seems to me that the error originates here:

```julia
function split_cfg_entry(ce::ConfigEntry)
    key = unsafe_string(ce.name)

    # Determine the positions of the delimiters
    subsection_delim = something(findfirst(isequal('.'), key), 0)
    name_delim = something(findlast(isequal('.'), key), 0)

    section = SubString(key, 1, subsection_delim - 1)
    subsection = SubString(key, subsection_delim + 1, name_delim - 1)
    name = SubString(key, name_delim + 1)
    value = unsafe_string(ce.value)

    return (section, subsection, name, value)
end

```

which appears to be pure Julia code. Wouldn’t you agree?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [August 18, 2022, 6:13pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/4 "2022-08-18T18:13:05Z")

</div>

Please post what you did and the error message that resulted.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 18, 2022, 6:15pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/5 "2022-08-18T18:15:11Z")

</div>

```julia
                                                                                    
julia> using Pkg; Pkg.update();                                                       
    Updating registry at `C:/Users/pkonl/SublimeJulia_1.8/assets/.julia-1.8.0-depot\registries\General.toml`                                                                
    Updating git-repo `https://github.com/PetrKryslUCSD/HelmBEM.jl.git`               
ERROR: AssertionError: name == "helper"                                               
Stacktrace:                                                                           
  [1] credential_helpers(cfg::LibGit2.GitConfig, cred::LibGit2.GitCredential)         
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\gitcredential.jl:224                                                   
  [2] fill!(cfg::LibGit2.GitConfig, cred::LibGit2.GitCredential)                      
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\gitcredential.jl:148                                                   
  [3] GitCredential                                                                   
    @ C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\gitcredential.jl:30 [inlined]                                                  
  [4] authenticate_userpass(libgit2credptr::Ptr{Ptr{Nothing}}, p::LibGit2.CredentialPayload)                                                                                
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\callbacks.jl:196                                                       
  [5] credentials_callback(libgit2credptr::Ptr{Ptr{Nothing}}, url_ptr::Cstring, username_ptr::Cstring, allowed_types::UInt32, p::LibGit2.CredentialPayload)                 
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\callbacks.jl:331                                                       
  [6] credentials_callback(libgit2credptr::Ptr{Ptr{Nothing}}, url_ptr::Cstring, username_ptr::Cstring, allowed_types::UInt32, payloads::Dict{Symbol, Any})                  
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\callbacks.jl:354                                                       
  [7] macro expansion                                                                 
    @ C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\error.jl:108 [inlined]                                                         
  [8] fetch(rmt::LibGit2.GitRemote, refspecs::Vector{String}; options::LibGit2.FetchOptions, msg::String)                                                                   
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\remote.jl:299                                                          
  [9] fetch(repo::LibGit2.GitRepo; remote::String, remoteurl::SubString{String}, refspecs::Vector{String}, credentials::Nothing, callbacks::Dict{Symbol, Tuple{Ptr{Nothing}, Any}})                                                                               
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\LibGit2.jl:293                                                         
 [10] fetch(io::Base.TTY, repo::LibGit2.GitRepo, remoteurl::String; header::Nothing, credentials::Nothing, refspecs::Vector{String}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})                                                       
    @ Pkg.GitTools C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\GitTools.jl:167                                                       
 [11] (::Pkg.Types.var"#47#48"{Pkg.Types.Context, Pkg.Types.PackageSpec, String})(repo::LibGit2.GitRepo)                                                                    
    @ Pkg.Types C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\Types.jl:727                                                             
 [12] with(f::Pkg.Types.var"#47#48"{Pkg.Types.Context, Pkg.Types.PackageSpec, String}, obj::LibGit2.GitRepo)                                                                
    @ LibGit2 C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\LibGit2\src\types.jl:1153                                                          
 [13] handle_repo_add!(ctx::Pkg.Types.Context, pkg::Pkg.Types.PackageSpec)            
    @ Pkg.Types C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\Types.jl:702                                                             
 [14] up_load_versions!(ctx::Pkg.Types.Context, pkg::Pkg.Types.PackageSpec, entry::Pkg.Types.PackageEntry, level::Pkg.Types.UpgradeLevel)                                   
    @ Pkg.Operations C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\Operations.jl:1319                                                  
 [15] up(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, level::Pkg.Types.UpgradeLevel; skip_writing_project::Bool)                                            
    @ Pkg.Operations C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\Operations.jl:1355                                                  
 [16] up(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; level::Pkg.Types.UpgradeLevel, mode::Pkg.Types.PackageMode, update_registry::Bool, skip_writing_project::Bool, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})                                                                          
    @ Pkg.API C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\API.jl:341                                                                 
 [17] up(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Pkg.Types.PackageMode, Tuple{Symbol}, NamedTuple{(:mode,), Tuple{Pkg.Types.PackageMode}}})                                                                                 
    @ Pkg.API C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\API.jl:156                                                                 
 [18] up(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})                                        
    @ Pkg.API C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\API.jl:171                                                                 
 [19] up()                                                                            
    @ Pkg.API C:\Users\pkonl\SublimeJulia_1.8\assets\julia-1.8.0\share\julia\stdlib\v1.8\Pkg\src\API.jl:162                                                                 
 [20] top-level scope                                                                 
    @ REPL[2]:1                                                                       
      

```

My `.gitconfig`:

```julia

[credential "helperselector"]
	selected = <no helper>

```

This is created by the “helper selector”, apparently installed with Git.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 18, 2022, 6:19pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/6 "2022-08-18T18:19:20Z")

</div>

Reverted the thread subject: the problem is not limited to v1.8.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [August 18, 2022, 6:54pm UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/7 "2022-08-18T18:54:35Z")

</div>

Would the environment variable `JULIA_PKG_USE_CLI_GIT` solve this? Then you can just use the git command that comes with Git for Windows?

```julia
ENV["JULIA_PKG_USE_CLI_GIT"]=true

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 19, 2022, 2:32am UTC](https://discourse.julialang.org/t/julia-fails-to-handle-properly-the-git-meta-credential-helper/85928/8 "2022-08-19T02:32:13Z")

</div>

> [@mkitti](#):
>
> `ENV["JULIA_PKG_USE_CLI_GIT"]=true`

Yes, thank you. The code failure is now forestalled. Alas, no credential helper is available still.  
I have to type in the username/password for all private repos.

Also, the julia prompt becomes messed up.
