Ssh: Could Not Resolve Hostname [Hostname]: Nodename Nor Servname Provided, or Not Known

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known

Recently I came across the same issue. I was able to ssh to my pi on my network, but not from outside my home network.

I had already:

  • installed and tested ssh on my home network.
  • Set a static IP for my pi.
  • Set up a Dynamic DNS service and installed the software on my pi.
    I referenced these instructions for setting up the static ip, and there are many more instructional resources out there.

Also, I set up port forward on my router for hosting a web site and I had even port forward port 22 to my pi's static IP for ssh, but I left the field blank where you specify the application you are performing the port forwarding for on the router. Anyway, I added 'ssh' into this field and, VOILA! A working ssh connection from anywhere to my pi.

I'll write out my router's port forwarding settings.

(ApplicationTextField)_ssh     (external port)_22     (Internal Port)_22     (Protocal)_Both     (To IP Address)_192.168.1.###     (Enabled)_checkBox

Port forwarding settings can be different for different routers though, so look up directions for your router.

Now, when I am outside of my home network I connect to my pi by typing:

ssh pi@[hostname]

Then I am able to input my password and connect.

Git push error: ssh: Could not resolve hostname domain.com[:7555]: nodename nor servname provided, or not known

Try removing the square brackets in the URL.

ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository

I was getting the same error.

Change the [remote "origin"] url value in .gitconfig or .config/git/config file

Previously:

https://git@github.com:userName/repo.git

OR

ssh://git@github.com:userName/repo.git

New:

git@github.com:userName/repo.git

Ubuntu ssh: Could not resolve hostname myserver: Name or service not known

The problem is, that your local computer do not know myserver.
So you have several option:

1.) You can edit your local /etc/hosts
and set there the public IP to myserver, but than you need to do it on all computer which should access myserver

2.) If you are own a domain, you can set the public IP of your server to myserver.mydomain.com in your DNS configuration.

3.) You can also set myserver in .ssh/config

Host myserver
Hostname ec2-xxx-xxx-xxx-xxx.eu-central-1.compute.amazonaws.com
IdentityFile /Users/TNowak/.ssh/id_rsa


Related Topics



Leave a reply



Submit