Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "malformed URL" error when performing remote actions using GitKraken in a corporate environment?

When using GitKraken and attempting to perform remote actions (push/pull/fetch and possibly clone) in my corporate environment I get an error that looks like this:

GitKraken Error

Fetch failed for 'origin'
malformed URL
[Proxy information]

My repository is only accessible internally and the error message above isn't the proper remote. I've verified the proper remote on the local repository via git remote -v. I've also verified this is not a git issue since I can perform all the necessary actions with git via the command line.

My organization's Proxy Auto Configuration (PAC) file is set up properly and returns DIRECT (meaning no proxy) for my remote.

Questions:

  1. Why is GitKraken using a proxy when I haven't configured one?
  2. Why is GitKraken using an external proxy for internal addresses?
  3. How can I resolve this and be able to interact with my remotes?
like image 670
Caesar Kabalan Avatar asked Mar 13 '17 18:03

Caesar Kabalan


2 Answers

Why is GitKraken using a proxy when I haven't configured one?

GitKraken is automatically pulling proxy configuration from your system's proxy settings (Internet Options > Connections > LAN Settings). In your case it looks like you have configured a PAC file in the "Automatic configuration" section. GitKraken (or one of the libraries it uses) is reading this file and determining how to contact external systems.

Why is GitKraken using an external proxy for internal addresses?

GitKraken (or one of the libraries it uses) appears to be incorrectly assuming proxy settings. When GitKraken starts it connects to its update servers. Before it connects it determines how to connect to it via the PAC file. In this case, you likely use a proxy for external internet access to this connection occurs via your proxy. When you attempt to perform an action on a remote this lookup does not happen again. It incorrectly re-uses the proxy configuration from the update check for internal repositories.

How can I resolve this and be able to interact with my remotes?

You have a few options:

  1. Temporarily disable your proxy configuration when you open GitKraken. You can turn off all proxies via Internet Options > Connections > LAN Settings. Open GitKraken, wait for it to fully start. Turn your proxy settings back on. You should be able to perform actions as normal.
  2. Modify your Proxy Auto Configuration (PAC) file to return DIRECT (no proxy) for the GitKraken update servers. This will "trick" GitKraken into thinking a proxy is not necessary and will not attempt to use it for local traffic. I suggest configuring your PAC file to return DIRECT for the following wildcard: *://*.gitkraken.com/*

For example in the FindProxyForURL function: if (shExpMatch(url, "*://*.gitkraken.com/*")) { return "DIRECT"; }

Note: If your organization has firewalls that prevent direct internet access you may need to take additional care here as this could affect your ability to access public repos such as those at GitHub. You may need to leave proxies on for external repositories and do the #1 option for internal repositories.

like image 60
Caesar Kabalan Avatar answered Sep 19 '22 18:09

Caesar Kabalan


To answer your question "why is GitKraken using a proxy when I haven't configured one?" GitKraken on mac uses the global network configurations(Network preferences > Select the network interface > Click Advanced... > and select proxy tab. If you have configured "Automatic Proxy Configuration" or "HTTP" or "HTTPS" proxy settings then that's what gets used.

If you have selected "Auto proxy Discovery" or "Automatic Proxy Configuration" then the "Bypass proxy settings for these hosts & Domains" usually does not work.

How can I make this work? I tried multiple solutions but the one that has worked for me was the following -

I am on GitKraken version 6.5.3. I am working behind proxies as well. GitKraken uses the global ~./gitconfig file and if you have configured the proxies there then it would use that in the absence of other configuration. I had specific settings -

[http]
    sslVerify = true
    proxy = "http://myproxy.com"
[https]
    sslVerify = false
    proxy = "https://myproxy.com"
[http "https://internalurls.com/"]
   sslVerify = false
    proxy = ""

This configuration works for the git command line, and the internal urls are resolved properly, but GitKraken only is using the http and https configurations and not the specific urls configuration. So every time I configure/try to connect to the internal urls I comment out the lines for the general http and https proxies and that has worked for me.

I hope GitKraken in the future gives the users the option to select the proxies or read the entire gitconfig section to search for all the proxies.

I hope this answer helps you.

like image 29
Steve_Greenwood Avatar answered Sep 21 '22 18:09

Steve_Greenwood