Error “The authenticity of host 'github.com' can't be established. RSA key fingerprint ”

前端 未结 4 1485
梦毁少年i
梦毁少年i 2021-02-19 04:00

I use my project at work, but I would like to work with him from home as I can log into my home machine to work with my project.

However, from home, I see the following

相关标签:
4条回答
  • 2021-02-19 04:18

    Use one of the following two solutions:

    1) Set up the SSH key

    Follow the steps discussed on this GitHub help page.

    https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

    2) Clone using git with HTTPS

    Type (copy/paste) the following commands in a terminal on the machine where you would like to clone the repository

    git config --global url."https://github.com/".insteadOf git@github.com:
    git config --global url."https://".insteadOf git://
    

    You can revert this change using the following commands

    git config --global url."git@github.com:".insteadOf https://github.com/
    git config --global url."git://".insteadOf https://
    
    0 讨论(0)
  • 2021-02-19 04:23

    As you are attempting to connect to Github using SSH for the first time (no existing entry for Github in ~/.ssh/known_hosts yet), you are being asked to verify the key fingerprint of the remote host. Because, if an intruder host represents itself as a Github server, it's RSA fingerprint will be different from that of a GitHub server fingerprint.

    You have two options.

    1. You may just accept, considering you don't care about the authenticity of the remote host (Github in this case), or,

    2. You may verify that you are actually getting connected to a Github server, by matching the RSA fingerprint you are presented to (in the prompt), with GitHub's SSH key fingerprints in base64 format.

    The latter option is usually more preferable.

    0 讨论(0)
  • 2021-02-19 04:34

    You should simply be able to answer 'yes', which will update your ~/.ssh/known_hosts file.

    After that, you can use a GitHub SSH URL (provided you have generated the SSH public/private keys, and registered the public one to your GitHub profile)

    Note: the ssh key generation should use the base64 old PEM format (option -m PEM), rather than the new current 70 chars OpenSSH one.
    See "What is the correct format for private key in Credentials":

    ssh-keygen -m PEM -t rsa -P "" -f afile
    

    That or you can switch to an HTTPS URL.

    0 讨论(0)
  • 2021-02-19 04:35

    Try these steps:

    Open Git Bash

    Check for existing SSH keys:

    $ ls -al ~/.ssh

    If you already have them, you will see:

    id_rsa.pub

    id_ecdsa.pub

    id_ed25519.pub

    If you don't, generate one (Press Enter to accept the default file location):

    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

    To copy the key to clipboard:

    $ clip < ~/.ssh/id_rsa.pub

    Go to your account on Github/Settings/SSH and GPG keys/New SSH key

    Paste your key there

    Next, type:

    $ git remote

    If you see origin, remove it:

    $ git remote remove origin

    Continue with the last 2 steps provided on GitHub repo page...

    $ git remote add origin git@github.com:USERNAME/REPONAME.git

    $ git push -u origin master

    Refresh your GitHub repo page

    Voila!

    0 讨论(0)
提交回复
热议问题