Search code examples
gitproxypacgitkrakenzscaler

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?

Solution

  • 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.