# Troubleshooting libgit2

**URL:** <https://discourse.julialang.org/t/troubleshooting-libgit2/1542>\
**Category:** General Usage\
**Tags:** windows, proxy\
**Created:** [January 17, 2017, 11:52am UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542 "2017-01-17T11:52:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pyrex41](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Post date:** [January 17, 2017, 11:52am UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/1 "2017-01-17T11:52:39Z")

</div>

I am trying to troubleshoot libgit2 failing behind a proxy (see [Pkg.add() through proxy fails on Julia 0.5, Windows](https://discourse.julialang.org/t/pkg-add-through-proxy-fails-on-julia-0-5-windows/687)). I am looking through the libgit2 functions ([https://github.com/JuliaLang/julia/tree/master/base/libgit2](https://github.com/JuliaLang/julia/tree/master/base/libgit2)) to try to find some way to find out what proxy libgit2 is grabbing from gitconfig. I am confused by the different types and not sure which functions (if any) will accomplish my goal. Can someone point me in the right direction?

---

<div class="post-metadata">

**Author:** ![pyrex41](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Post date:** [January 18, 2017, 9:06pm UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/2 "2017-01-18T21:06:20Z")

</div>

Is this more of a development question? It seems to me it’s about usage but perhaps the people involved in the development of the libgit2 support would be a good resource.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [January 18, 2017, 11:12pm UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/3 "2017-01-18T23:12:28Z")

</div>

All of the config should happen automatically. I just verified that it does, at least in a test rig, with Julia 0.5 on an IEEdge Windows VM. I set VirtualBox to allow only local traffic and installed squid 3 from homebrew (with default config except for `dns_nameservers 8.8.8.8 8.8.4.4`).

Config file at `C:\Users\IEUsers\.gitconfig` with contents:

```julia
[url "https://github.com/"]
    insteadOf = git://github.com/
[https]
    proxy = http://[vboxnet0 host IP]:3128
[http]
    proxy = http://[vboxnet0 host IP]:3128

```

(replace [vboxnet0 host IP] with your proxy server details)  
Note that the standard git-bash client uses the same config file, so you could install it as well and cross-test.

> I am confused by the different types and not sure which functions (if any) will accomplish my goal. Can someone point me in the right direction?

libgit2 is written in C, so I can only point you to the source code. libgit2 proxy-related functionality is not currently wrapped, except for a type stub for `git_proxy_options`. There is a function to set it manually (`git_proxy_init_options`), [ref](https://github.com/libgit2/libgit2/pull/3110). If you want to see what happens in libgit2 internally, grep for the above keywords and some others like `apply_proxy_config` and `git_proxy_t`.

libgit2 should [eventually](https://github.com/libgit2/libgit2/pull/2589) be able to detect and use system-level Windows proxy config automatically.

> Is this more of a development question? It seems to me it’s about usage but perhaps the people involved in the development of the libgit2 support would be a good resource.

The intersection of the sets “people who use Windows” and “people who develop Julia” is essentially empty.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [January 19, 2017, 3:07am UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/4 "2017-01-19T03:07:29Z")

</div>

4 posts were split to a new topic: [Windows usage questions](https://discourse.julialang.org/t/windows-usage-questions/1579)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [January 19, 2017, 3:08am UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/5 "2017-01-19T03:08:29Z")

</div>

Cross-ref suggestion from another thread: don’t use credentials, if you can avoid it:

> [@Pkg.add() through proxy fails on Julia 0.5, Windows](https://discourse.julialang.org/t/pkg-add-through-proxy-fails-on-julia-0-5-windows/687/15):
>
> I think libgit2 might not parse user credentials in the proxy setting properly. Specifying username and password does not work for me on Julia v0.5 (libgit2). It did work on Julia v0.4 (git). proxy = http://username:password@server:port results in the following error on Julia v0.5: ERROR: GitError(Code:ERROR, Class:OS, Failed to set proxy: The parameter is incorrect.) Omitting the username and password seems to work: proxy = http://server:port So this is what I have now in .gitconfig in h…

---

<div class="post-metadata">

**Author:** ![pyrex41](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Post date:** [January 26, 2017, 12:31pm UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/6 "2017-01-26T12:31:22Z")

</div>

0.6 definitely is different. Now though, I get a different error:

`GitError(Code:ERROR, Class:OS, failed to send request: The operation timed out).`

Should I open a separate thread?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [January 26, 2017, 3:19pm UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542/7 "2017-01-26T15:19:12Z")

</div>

(I moved over to the topic you started)

Does your proxy server require authentication?  
Does [GitHub desktop](https://desktop.github.com/) work for you? Or one of the other [libgit2-based projects](https://libgit2.github.com/)? If so then you can try to figure out what they are doing differently.
