<-- Back

Error: The server returned an invalid or unrecognized response while setting up Git repository behind a proxy or firewall

Issue

The user is trying to use the Git repository under a proxy or firewall environment and the following error message appears:

LibGit2Sharp.LibGit2SharpException: failed to receive response: The server returned an invalid or unrecognized response

at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_connect(RemoteHandle remote, GitDirection direction, GitRemoteCallbacks& remoteCallbacks, GitProxyOptions& proxyOptions)
at LibGit2Sharp.Repository.ConnectToAnonymousRemote(RepositoryHandle repositoryHandle, String url, CredentialsHandler credentialsProvider, CertificateCheckHandler certificateCheckHandler, GitProxyOptions proxyOptions)
at LibGit2Sharp.Repository.ListRemoteReferences(String url, CredentialsHandler credentialsProvider, CertificateCheckHandler certificateCheckHandler, ProxyOptions proxyOptions)
at Mendix.Modeler.VersionControl.Git.GitRemoteConnector.ListRemoteReferences(String remoteUrl) in C:\Users\Autobuild\workspace\AppStudio4.0-Build\modeler\Mendix.Modeler.VersionControl\Git\GitRemoteConnector.cs:line 21
at Mendix.Modeler.VersionControl.Operations.Git.GitGetBranchesOperation.ListRemoteBranches(String remoteUrl) in C:\Users\Autobuild\workspace\AppStudio4.0-Build\modeler\Mendix.Modeler.VersionControl\Operations\Git\GitGetBranchesOperation.cs:line 119
at Mendix.Modeler.VersionControl.Operations.Git.GitGetBranchesOperation.GetBranchesRemotely(String remoteUrl) in C:\Users\Autobuild\workspace\AppStudio4.0-Build\modeler\Mendix.Modeler.VersionControl\Operations\Git\GitGetBranchesOperation.cs:line 111
at Mendix.Modeler.VersionControl.Operations.Git.GitGetBranchesOperation.Execute(GetBranchesRequest& request) in C:\Users\Autobuild\workspace\AppStudio4.0-Build\modeler\Mendix.Modeler.VersionControl\Operations\Git\GitGetBranchesOperation.cs:line 49

Environment

  • Version Control
  • Studio Pro version 9.21 and newer

Cause

Proxy is currently not supported with Git for Windows, so it is not integrated with Studio Pro.

Solution/Workaround

As a workaround, the user can configure the proxy settings directly by either overriding the environment variables:http_proxy, https_proxy and all_proxy; or by setting the proxy URL in the locarl.git/config via the following commands:

  1. Configure the proxy settings:
    git config --local http.proxy 
    [protocol://][user[:password]@]proxyhost[:port]

    A full example could look like:
    git config --local http.proxy 
    http://proxyuser:proxypwd@proxy.server.com:8080
  2. Check if the setting has changed:
    git config --local http.proxy

    Based on the above example one would expect to see the following output:

http://proxyuser:proxypwd@proxy.server.com:8080

It is possible to use --global flag for applying the changes system-wide, but it is not recommended if Git is not only utilized for Mendix development.

Internal information related

  • 186030, 186862

Additional information 

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.