Warning: Permanently added the RSA host key for IP address

GitGithubSsh

Git Problem Overview


When I do pull from Github, I am getting this warning message.

    MYPC:/Rails$ git pull origin master
    Warning: Permanently added the RSA host key for IP address '#{Some IP address}' to the list of known hosts.
    From github.com:Example/Demo
     * branch            master     -> FETCH_HEAD
    Already up-to-date.

I just want to know which IP address it is adding to the known hosts.

Git Solutions


Solution 1 - Git

> If you are accessing your repositories over the SSH protocol, you will receive a warning message each time your client connects to a new IP address for github.com. As long as the IP address from the warning is in the range of IP addresses , you shouldn't be concerned. Specifically, the new addresses that are being added this time are in the range from 192.30.252.0 to 192.30.255.255. The warning message looks like this:

> Warning: Permanently added the RSA host key for IP address '$IP' to the list of

https://github.com/blog/1606-ip-address-changes

Solution 2 - Git

The IP addresses have changed again.

github publishes the list of used IP addresses here so you can check the IP address in your message against github's list:

https://help.github.com/articles/about-github-s-ip-addresses/

Or more precisely:

https://api.github.com/meta

It looks like this (as I write this answer!):

verifiable_password_authentication	true
github_services_sha	"4159703d573ee6f602e304ed25b5862463a2c73d"
hooks	
0	"192.30.252.0/22"
1	"185.199.108.0/22"
git	
0	"192.30.252.0/22"
1	"185.199.108.0/22"
2	"18.195.85.27/32"
3	"18.194.104.89/32"
4	"35.159.8.160/32"
pages	
0	"192.30.252.153/32"
1	"192.30.252.154/32"
importer	
0	"54.87.5.173"
1	"54.166.52.62"
2	"23.20.92.3"

If you are unsure whether your IP address is contained in the above list use an CIDR calculator like http://www.subnet-calculator.com/cidr.php to show the valid IP range.

E. g. for 140.82.112.0/20 the IP range is 140.82.112.0 - 140.82.127.255

Solution 3 - Git

Here are the steps that i took to solve the issue and you can try also

  1. Open git bash terminal
  2. type ssh-keygen and hit enter
  3. then terminal will ask to enter the file name to save the rsa key.you can hit enter not
    -typing anything
  4. After that terminal will ask for other information too. without typing anything just hit enter By completing every steps a rsa key will be generate in the mentioned file.
  5. Go to C:\Users\<username>\.ssh and open a file named id_rsa.pub in notepad and copy the key
  6. then go to your github account Settings and select the option SSH and GPS keys .
  7. Create a new ssh key with a title and the key you just copied (you just generated) hit save now if you try to push by git push origin master I hope you wont get any error

Solution 4 - Git

From: https://github.blog/changelog/2019-04-09-webhooks-ip-changes/

> April 9, 2019 > > # Webhooks IP changes > > The IP addresses we use to send webhooks from are broadening to encompass a larger range. > > We are adding IP’s within 140.82.112.0/20 to the current pool from 192.30.252.0/22. > > Learn more about GitHub’s IP addresses

Solution 5 - Git

I had similar problem. In git site after user clicking on clone or download button, while copying the cloned url there are 2 options to select ssh and https. I selected https url to clone and it worked.

Solution 6 - Git

You can remove the warning for github.com with an entry in your ~/.ssh/config file:

Host github.com
    CheckHostIP no

From the ssh_config man page: > CheckHostIP > > If this flag is set to ''yes'', ssh(1) will additionally > check the host IP address in the known_hosts file. This allows ssh to > detect if a host key changed due to DNS spoofing. If the option is set > to ''no'', the check will not be executed. The default is ''yes''.

So setting the flag to 'no' will suppress the check for the Host IP, and will allow any IP for the host (github.com), no matter how often it changes.

Solution 7 - Git

E.g. ip 192.30.253.112 in warning:

$ git clone git@github.com:EXAMPLE.git
Cloning into 'EXAMPLE'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
remote: Enumerating objects: 135, done.
remote: Total 135 (delta 0), reused 0 (delta 0), pack-reused 135
Receiving objects: 100% (135/135), 9.49 MiB | 2.46 MiB/s, done.
Resolving deltas: 100% (40/40), done.

It's the ip if you nslookup github url:

$ nslookup github.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   github.com
Address: 192.30.253.112
Name:   github.com
Address: 192.30.253.113

$ 

Solution 8 - Git

While cloning you might be using SSH in the dropdown list. Change it to Https and then clone.

Solution 9 - Git

You can remove the warning brutally by just editing the file ~/.ssh/known_hosts and remove all lines whose key is the same as that associated with the IP address.

For example, if you have "Warning: Permanently added the RSA host key for IP address '140.82.114.4' to the list of known hosts.", open the file ~/.ssh/known_hosts and remove the following lines:

...
140.82.114.3 ssh-rsa AAAAB3NzaC1y...
140.82.114.4 ssh-rsa AAAAB3NzaC1y...
...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAshwiniView Question on Stackoverflow
Solution 1 - GitRajarshi DasView Answer on Stackoverflow
Solution 2 - GitR YodaView Answer on Stackoverflow
Solution 3 - GitRumanView Answer on Stackoverflow
Solution 4 - GitJamie BortView Answer on Stackoverflow
Solution 5 - GitKurkulaView Answer on Stackoverflow
Solution 6 - GitJaleksView Answer on Stackoverflow
Solution 7 - Git林果皞View Answer on Stackoverflow
Solution 8 - GitSaurabh BishtView Answer on Stackoverflow
Solution 9 - GitPiozView Answer on Stackoverflow