Clone repo without DNS relolving

Hi guys,

I have a server with an access to Github.com by ports 80, 443, but it doesn’t has a DNS resolving. Therefore when I try to clone with an HTTS  protocol, I get an error.

My question is how can I clone a Github.com repo by IP (or maybe something else)?

2 Likes

Hi @mici37000,

What sort of error are you receiving?

Thanks!

I actually don’t know what to write in the git clone command in order to clone a repo from github?

which IP should I use? Can you write and the full command line?

You can find information about GitHub’s IP address ranges in our help documentation. Because the IP addresses we use change from time to time, we don’t recommend hardcoding a specific IP address and using DNS instead. If DNS is not working for you, you can use the API mentioned in the above link to get the IP address ranges in CIDR notation. There is a tool linked in the help documentation that will help you to translate the CIDR range into a range of human-readable IP addresses. From there, you can pick one IP within the range to use. You will have to replace the text github.com in the HTTPS clone URL (which looks like [https://github.com/owner/repo.git](https://github.com/owner/repo.git)) with the IP address you choose to use.

Please note: these IP address ranges will change over time and any repository you clone using this technique may break at some undetermined point in the future. At that point, you will have to go through this whole process again.

I hope that helps!