GitHub Windows client behind proxy

后端 未结 9 1462
抹茶落季
抹茶落季 2020-12-02 04:40

I\'m trying to get the GitHub client for Windows working. I am on a corporate Win 7 x64 computer behind a corporate proxy and firewall. Following various other posts and exp

相关标签:
9条回答
  • 2020-12-02 05:19

    Here is the way to set proxy in github

    git config --global http.proxy http://<username>:<pass>@<ip>:<port>
    git config --global https.proxy http://<username>:<pass>@<ip>:<port>
    

    Here in my college we don't have username and password, so if our college ip is 172.16.10.10 and port is 8080

    git config --global http.proxy http://172.16.10.10:8080
    git config --global https.proxy http://172.16.10.10:8080
    

    P.S -> I would recommend using this method to set proxy as things will fall into place as you will learn further
    Source

    0 讨论(0)
  • 2020-12-02 05:21

    For us, the solution involved two different things. First, as described in Sogger's answer, you need to add the entries to your .gitconfig file, located in %USERPROFILE%.

    [http]
        proxy = http://<proxy address>:<proxy port>
    
    [https]
        proxy = https://<proxy address>:<proxy port>
    

    Second, (and this was the missing piece for us,) you need to configure an exception on the proxy server to allow non-authenticated proxy traffic to *.github.com

    In iPrism, it looks like this:

    The problem is not so much the proxy, but the authentication. Bypassing the authentication requirement allows the needed communication to clone and work with projects using the GitHub desktop client.

    Also note that this approach did not require storing proxy credentials in the .gitconfig file.

    0 讨论(0)
  • 2020-12-02 05:23

    If you’re using GitHub for Windows in a corporate, chances are high that you’re behind a big bad Corporate Firewall/Proxy. GitHub for Windows doesn’t yet have the proxy parameters in its GUI for setting Options.

    To configure GitHub for Windows to use your corporate proxy, edit the .gitconfig file typically found at C:\Users\.gitconfig or C:\Documents & Settings\.gitconfig

    Close GitHub for Windows; In .gitconfig, just add

    [https] proxy = proxy.yourcompany.com:port

    0 讨论(0)
  • 2020-12-02 05:24

    I've also run into this issue, and tried to dig into it a bit as well (disassembled the client).

    The piece of code that generates the log messages we're seeing is as follows:

    private static void LogProxyServerConfiguration()
    {
        WebProxy defaultProxy = WebProxy.GetDefaultProxy();
        string str = defaultProxy.Address != (Uri)null ? defaultProxy.Address.ToString() : "(None)";
        StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Proxy information: {0}", str);
        try
        {
            if (defaultProxy.Credentials == null)
            {
                StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Couldn't fetch creds for proxy", new object[0]);
            }
            else
            {
                NetworkCredential credential = defaultProxy.Credentials.GetCredential(GitHubClient.GitHubDotComUri, "Basic");
                StartupLogger.log.Info((IFormatProvider)CultureInfo.InvariantCulture, "Proxy is authenticated: {0}", credential != null && !string.IsNullOrWhiteSpace(credential.UserName));
            }
        }
        catch (Exception ex)
        {
            StartupLogger.log.InfoException("Couldn't fetch creds for proxy", ex);
        }
    }
    

    So this block only logs the proxy information that's setup in IE. The log message appears to have no bearing on what we have setup in the config files or environmental variables.

    0 讨论(0)
  • 2020-12-02 05:28

    Tried everything of above - and didn't succeed, only thing that helped me is CNTLM - http://cntlm.sourceforge.net/.

    Install it and run cntlm -H, than authenticate to corp proxy, edit cntlm.ini file with the output of cntlm, restart the windows service. Update .gitconfig with:

    [https] proxy = localhost:3128
    [http] proxy = localhost:3128
    

    Now cntlm will do all the authentication, and you'll be able to use GitHub(and Dropbox, btw) behind the corp proxy. At least until next password change :) (than do cntlm -H stuff again)

    0 讨论(0)
  • 2020-12-02 05:30

    i dont know about your firewall, but my campus use proxy

    do you use any git gui? EDIT : just noticed that you're using github client for windows

    i am using tortoisegit and its very easy to set the proxy. Just right click anywhere, tortoisegit>network, enable proxy server and set server address, username, and password. done

    as far as i remember, tortoisegit will also works out-of-the-box with github.

    0 讨论(0)
提交回复
热议问题