Fix – WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

Recently GitHub updated their RSA SSH host key so you might be having an error while pushing changes as shown in the below image

This can be fixed by running following commands:

ssh-keygen -R github.com

curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts

Full details can be found here: https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/

How to fix – Fingerprint has already been taken

Sometimes we have “Fingerprint has already been taken” while adding our ssh key.

To fix that issue, we need to generate a new ssh key. But the problem is your existing ssh key is added to other resources so if you generate a new one, you have to replace it everywhere.

Instead of doing this, generate a new ssh key in a new file and add it wherever it is needed.

Run the following commands on the terminal to generate the SSH key:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Then it will ask where to generate:

Generating public/private rsa key pair. 
Enter file in which to save the key (/home/<NAME>/.ssh/id_rsa):

Give the following name for the file

/home/<NAME>/.ssh/id_rsa2

And the last step is to add it to the file by the following command:

ssh-add ~/.ssh/id_rsa2

Permission denied to git repo pushing

Sometimes we have an error like below when we try to push on Github.

Try to check where is your ssh key is being used by the following command:

 ssh -T -ai ~/.ssh/id_rsa [email protected]

You will get a response like this:

So, in my case, my ssh key was being used by my other GitHub account. Now you have 2 choices.

  1. Remove ssh key from other account and add to your account where you are trying to push
  2. Generate new ssh key and use it.

I did 1st as It was not needed for my other account.

Git is not working after macOS Update

Yesterday I updated my macOS to latest Catalina version. After updating it GIT was not working. That always happens to me :-).

I was getting following error.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

 

Many of you might also get this error. So the solution is pretty simple. Just follow a couple of steps and solve the problem.

Step 1: Open Terminal and run following command

xcode-select --install

Step 2: After this command, there will be a prompt to update the software. So update that.

And wait for the software to be updated.

That’s it.

 

Ref: https://stackoverflow.com/questions/52522565/git-is-not-working-after-macos-update-xcrun-error-invalid-active-developer-pa