1

I am trying to push my changes to a remote repository on GitHub using the command git push, but I get this error:

fatal: unable to access https://github.com/something.git :Failed to connect to 192.168.2.3 port 1080 after 3063 ms: No route to host

I have checked my proxy settings and they are disabled, so I don’t understand why it is trying to connect to 192.168.2.3 port 1080. This problem happens with other repositories as well, not just this one.

I have searched for similar questions on Stack Overflow, but none of the solutions worked for me. For example, I have tried:

  • Setting http.proxy and https.proxy to empty strings in my git config

  • Using git config --global --unset http.proxy and git config --global --unset https.proxy

  • Using git config --global --add remote.origin.proxy ""

  • Using a different protocol (ssh) instead of https

None of these methods solved the problem. I still get the same error.

What could be causing this issue and how can I fix it?

Marc Le Bihan
  • 2,308
  • 2
  • 23
  • 41
  • 3
    that's a networking problem, not something related to git. That sounds like you do not a a default gateway setup on that machine... or something like that. Talk to your network administrator. – eftshift0 Jul 25 '23 at 08:26
  • 1
    `192.168.2.3` is a local network. Internal to your office or VPN. You have networking problem not related to Git at all. Work on network configuration or ask network admins for help until you can do `ping 192.168.2.3` and `tracert 192.168.2.3` – phd Jul 25 '23 at 08:28
  • @marc-le-bihan, What part has Git in error "No route to host"? – phd Jul 25 '23 at 08:43
  • @phd I only added a tag to your post to allow it having a better audience and because eftshift0 believes it's a _Git_ related problem, which is possible, because Git relates often its problems with error status codes, some looking like network errors, even if it's not really the case. – Marc Le Bihan Jul 25 '23 at 08:46
  • Git is related (only) as it raises the error message from libcurl which forwards the error message for the error number ([ref](https://github.com/curl/curl/blob/c06d7e25bfdef672e85503d5ebb1000297744c38/lib/connect.c#L712)), perhaps EHOSTUNREACH from kernel. Which operating system/kernel are you using, what is the git version? Also please add the relevant part of your environment and from the git configuration to the question by [edit]ing it. – hakre Jul 25 '23 at 10:51

1 Answers1

1

What could be causing this issue[?]

For git-push(1) the message

fatal: unable to access 'https://example.com/something.git': Failed to connect to 192.168.2.3 port 1080 after 3063 ms: No route to host

is caused by HTTP_ERROR in remote_exists(). (ref; note the slight modifications I made to the error message to get a match.)

[H]ow can I fix it?

The standard fix to correct such connection errors is to specify the correct proxy server configuration, YMMV.


Discussion and References

You demonstrate in your question that you tried to unset the proxy configuration. This is the opposite and does not work for a fix, you have to configure the correct proxy server, and you must not unset it.

The current error message shows that libcurl for git(1) is unable to connect to the remote repository on the network level in your environment.

For guidance on how to configure a HTTP/S proxy for git(1), please see the following Q&A material:

Naturally consult the git manual and your operating system user and configuration manual.

Double-check with these resources, and gain more understanding how your operating systems' networking, its' environment and git(1)+libcurl play together for proxies and network access, and see the default port registry for the meaning of port 1080 (RFC 1928).

Last but not least, contact your network administration to obtain the correct proxy configuration and clarify anything that is not clear to you.

See as well the following meta Q&A material to better understand if it appears that answering your questions may be received as incomplete:

hakre
  • 193,403
  • 52
  • 435
  • 836