question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Getting http.proxy to work

See original GitHub issue

Hey guys,

I’ve got a repo set up at bitbucket. This repository is initialized locally with a reference to the http link provided from the site.

I am using LibGit2Sharp 0.23.1, and I am using the following to fetch from the remote server:

private bool fetch()
        {
            string logMessage = "";
            using (var repo = new Repository(settings.directory))
            {
                Remote remote = repo.Network.Remotes["origin"];
                IEnumerable<string> refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
                FetchOptions options = new FetchOptions();

                options.CredentialsProvider = getCredentials();
                Commands.Fetch(repo, remote.Name, refSpecs, options, logMessage);
            }
            Logger.debug(logMessage);
            return true;
        }

Inside config file of git I have the following added:

[http]
	proxy = http://<IP>:8888

I am using wireshark to sniff my outgoing packets and can confirm that using command-line git fetch, it is indeed using the configured proxy. Removing this setting from the config also confirms that it is not using the proxy. Also at my proxy server I can confirm that there is a connection going to bitbucket when fetching.

However when I use my code, which points to the same location where the repository is sitting at, it does not use the proxy at all. I don’t see any packets going to the proxy server in my Wireshark instance, nor in the logs of my proxy server. It is indeed fetching, just directly to the server.

I’ve googled quite a bit, I’ve tried setting up environment proxy variable, setting up proxy in Internet Explorer, setting up proxy on remote only. None of them work with my client.

I’m guessing I’ve got something misconfigured, just not sure what.

Hopefully you guys can help me out!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
plainionistcommented, Feb 25, 2018

any thoughts on timeline for fixing the issue?

1reaction
pfeiglcommented, Sep 29, 2021

Is there any known workaround to actually get libgit2sharp to work with proxies? Besides having the correct .gitconfig I also tried setting ´HTTP(S)_PROXY` env variables, but also this didn’t seem to work for me.

It’s kinda hard to believe that this usecase is not working at all, it feels like alot of people should have this problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

how does http proxy work?
The PROXY receives the response and forwards it back to the CLIENT. It is a transparent process and nearly like directly communicating with...
Read more >
Can't consume web services via an HTTP proxy server
This article provides a resolution to fix the error that occurs on a .NET client that consumes a Web service via an HTTP...
Read more >
Configure proxy for APT?
To use a proxy, you need a proxy server. The IP and port have to be from this proxy server. Login and pwd...
Read more >
'apt-get' does not work with Proxy
I tried to use gnome-network-proxy tool to set proxy settings system-wide. After that /etc/environment has been updated by http_proxy variable ...
Read more >
What is a Proxy Server and How Does it Work?
A proxy server acts as a gateway between you and the internet. Learn the basics about proxies with our complete, easy-to-follow guide.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found