How do I clone from my git server, over ssh, into my Linode

I have a Git server on a dynamic IP available over HTTPS and SSH (I've forwarded ports on my router 80, 443, 22).
I've added my deploy key to git, copied over the private ssh key to my Linode server, added it with ssh-add.
When I do git clone it hangs on connecting into [IP address].
When I try to clone over HTTPS I get unable to access Failed to connect to port 443
When I ping my router public IP from my ssh shell on Linode server I get 0 received, 100% packet loss.
I can clone the private Git repo on other PC's that are outside my LAN (they also have the same ISP, don't know if it matters).

5 Replies

Hey there!

There could be a few possible reasons for this, and a few ways to see where this is failing. First, I think it's best to test the connection between your Linode and the local machine. The best way to do this is to run an MTR from your Linode to the git server, then from the git server to the Linode. You can do this with the following command:

mtr -rwbzc 100 <IP address>

You can read more about how to install and run MTR at our excellent guide. If the last hop where your git server's IP address should be has 100% packet loss, that isn't necessarily a sign that there's no connection. It may be ICMP is disabled on your router or the server. If the connection fails before that, however, or if there is significant packet loss, that may be something reaching out to your ISP about, or possibly opening a Support Ticket in Linode Manager.

Assuming the above looks alright, you can test your connection to specific ports on the github server. You can do this by running the following command:

telnet <IP address> <port>

For example:

telnet <IP address> 22
Trying <IP address>...
Connected to <RDNS>.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.6p1 Ubuntu-4

If you are able to make that successful connection, it means the port is indeed open and actively listening. If you are unable to make the connection, then it may mean there is no service listening on that port. For example:

telnet <IP address> 443
Trying <IP address>...
telnet: connect to address <IP address>: Connection refused
telnet: Unable to connect to remote host

That would be something you can then check with your firewall.

It may also be worth investigation connection attempts from the side of the Git server. Checking /var/log/auth.log could show you connection attempts you've made over port 22 and why they hang or have been denied. Similarly you might have luck checking the logs for the services you have listening over port 80.

Once you are certain the network connectivity and firewall are not the issue, investigating the services individually would, I believe, be the way to do. I would also recommend taking a look at the Copying Your Disk over SSH guide to see if that is useful to you once you are certain networking isn't the issue.

With regards to not being able to connect over port 443, you need to make sure the line sslVerify = false[http] is in your gitconfig file.

If you still require additional help, can you also provide us some of the commands you are running so we can take a look at those and see if we can provide you with any additional information? Thank you in advance!

Hi Scrane,

Thanks for your help. I've tried mtr and kept getting '???'. I also noticed that the IP showing in my router's public IP was different from the one showing outside of ISP (whatsmyip.com) so I contacted the ISP and they said that there were 2 IPs activated for my account (don't know what that means) and they fixed that. I did a router reboot and now the same IP appeared.

And this seamed to do the trick. I can now clone my repo over HTTPS. I still have an issue with it over SSL, I know it's something about my configuration but don't know what. I've add my git deploy public key, and on server I've added the private key. I'll test more.

Thanks for everything,
Alex.

Hey Alex,

What do you see when you run curl -vIl https://<Git server>:443/ from your Linode? That might help provide some additional information about what's happening with your SSL.

I'm glad to hear you were able to figure out at least some of the issue, though! Keep us updated!

Hey Scrane,

Sry, I meant over SSH. After the IP was fixed by the ISP, everything worked with the SSL.
The SSH problem was a configuration error in Gitlab. I've added the public key to global, but I forgot to give access to it for the project

Thanks,
Alex

Hey Alex,

I'm glad to hear you were able to get that figured out! Thanks for updating us and letting us know how it went. Have a great day!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct