Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository

后端 未结 30 1820
青春惊慌失措
青春惊慌失措 2020-12-12 10:10

I am unable to clone a Git repository, and getting this error:

krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://stage.abc.com:10088/pqr
http://<         


        
相关标签:
30条回答
  • 2020-12-12 10:49

    It may be stupid but it happened to us:

    If you are using bitbucket and Sourcetree and you just copy paste the clone URL to the new repo dialog it will show the same error when pulling or pushing.

    Make sure you delete the 'git clone' stuff before the URL.

    0 讨论(0)
  • 2020-12-12 10:50

    I faced the same problem with GitHub. Here's how to solve it!

    1. Generate a SSH key on your computer as described here : Generating SSH keys.
    2. Login your GitHub account: GitHub Login.
    3. In your account, add the newly generated SSH Key: My account SSH keys.
    4. Try again to git clone the project.
    0 讨论(0)
  • 2020-12-12 10:50

    If all fails, as was the case with me, Uninstall GIT, reinstall. For some reason this fixes.

    P.S.

    1. I tried generating new Keys and Updating at SSH public keys
    2. Also tried deleting all keys and tried to create a fresh key.
    3. And NO, nothing wrong with my .gitconfig
    0 讨论(0)
  • 2020-12-12 10:50

    if none of these answers help and

    1. you are using Windows
    2. you generate your key with Putty or you have installed Putty on your PC
    3. you generate your key with CMD or PowerShell

    Try

    1. delete your keys
    2. search on windows for Git Bash, then generate a new key with Git Bash command line
    3. add public key to your online Repo

    Then, you will find after git clone and type yes to confirm, it should begin to clone

    0 讨论(0)
  • 2020-12-12 10:51

    I also faced the same issue. I did the following and it worked for me:

    1. Generate Keys from the GIT GUI client on Windows. Copy this key to the clipboard.
    2. Open up your account on bitBucket/ git website, and add this key to your profile. This way, the server knows that you are a legitimate user accessing from a legitimate system.
    3. That's it. All push commands worked for me henceforth.
    0 讨论(0)
  • 2020-12-12 10:51

    I got the error...

    Permission denied (publickey).
    fatal: Could not read from remote repository.
    Please make sure you have the correct access rights
    and the repository exists.
    

    ...when I was trying to make contact from a Git Bash prompt to Bitbucket after my laptop died from a bad Windows 10 update and was returned to factory settings. I had restored all my ssh files from a backup.

    The cause of the error turned out to be a mismatch in my Windows account name after the computer rebuild. I learned that the public key file id_rsa.pub ends with an easily readable string comprising my Windows account name followed by an @ sign and then the computer name.

    When I originally set up my computer, I created my Windows account name including my middle initial but when my computer was reset to factory settings, our new DevOps guy created my account name without my middle initial.

    To resolve the issue, I simply edited my public key file id_rsa.pub and removed the middle initial in my name at the end. I had stuck with the same computer name so that was okay. I copied the file contents to the Windows clipboard. I then signed into Bitbucket, went to Bitbucket Settings under my avatar, and added a new public key where I pasted in the new contents.

    Back at the Git Bash prompt, I confirmed that it now worked by entering the command...

    ssh -T git@bitbucket.org
    

    ...and I got back a message that I was signed in.

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