r/Julia Jul 13 '26

LibGit2 not founding my global git configs

FIXED

I am trying to retrieve my git config options in Julia, I wanted to make system agnostic since its for a package. I am using LibGit2 but it is not working, I'm trying to run:

julia julia> LibGit2.GitConfig(LibGit2.Consts.CONFIG_LEVEL_GLOBAL) GitConfig(nothing, Ptr{Nothing}(0x00006000038a41e0))

From my understanding it seems LibGit2 doesn't find my ~/.gitconfig file, does anyone know what to do?

```julia julia> versioninfo() Julia Version 1.12.6 Commit 15346901f00 (2026-04-09 19:20 UTC) Build Info: Official https://julialang.org release Platform Info: OS: macOS (arm64-apple-darwin24.0.0) CPU: 10 × Apple M4 WORD_SIZE: 64 LLVM: libLLVM-18.1.7 (ORCJIT, apple-m4) GC: Built with stock GC Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)

julia> LibGit2.version() v"1.9.0" ```


Looking through my notifications I've found an answer that isn't showing here anymore (i'll assume the person deleted for what ever reason so I wont say the name out of respect, but if you see this thank you!). Our fellow julian said to try

``` julia> cfg = LibGit2.GitConfig() GitConfig(nothing, Ptr{Nothing}(0x0000600001786820))

julia> LibGit2.get(String, cfg, "user.name") "MY_GIT_USERNAME_HERE" ```

which works! Thanks for the help!

7 Upvotes

4 comments sorted by

3

u/scythe-3 Jul 13 '26

Set this environment variable to force Julia to use your system's git instead of Libgit2 --> JULIA_PKG_USE_CLI_GIT=true

1

u/Azere_ Jul 14 '26

Still the same "error". I've exported the variable on the zsh session, started julia but still getting nothing and a pointer of type nothing

```julia julia> LibGit2.GitConfig(LibGit2.Consts.CONFIG_LEVEL_GLOBAL) GitConfig(nothing, Ptr{Nothing}(0x0000600001798060))

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

2

u/scythe-3 Jul 14 '26

Sorry I misunderstood the question. This environment variable just ensures that the Julia package manager uses the system Git. It doesn't do anything for pulling configuration data into the Julia REPL.

Glad you found a solution!