0

I have a server that has DNS problems and cannot find "Github.com". I have to use Github's IP address instead. But when I try to use the IP address like this:

git remote set-url origin http://192.30.253.113/foo/bar.git

when I try to push to origin this happens:

git push origin master

fatal: unable to access 'https://192.30.253.113/foo/bar.git/': SSL: certificate subject name (github.com) does not match target host name '192.30.253.113'

Navid777
  • 3,591
  • 8
  • 41
  • 69

1 Answers1

4

Git pull does not work, because Git verifies the SSL certificate and checks whether the hostname matches the name in the certificate. In your case the IP is not included in the certificate and, thus, you are getting this error.

An option could be to disable SSL (as described in https://stackoverflow.com/a/16869961/3906760), however, that would allow attackers to MitM your connection.

Instead of disabling SSL verification, why don't you add github.com to /etc/hosts (cf. https://ubuntuforums.org/showthread.php?t=3407), then SSL certificate validation would still work.

Community
  • 1
  • 1
MrTux
  • 32,350
  • 30
  • 109
  • 146