github: No supported authentication methods available

前端 未结 16 688
挽巷
挽巷 2020-11-29 16:46

i use github and have successfully added and synched files on my laptop in the past.

as of recent i started getting \"PuTTY Fatal Error: Disconnected: No su

相关标签:
16条回答
  • 2020-11-29 16:54

    If you're using Pageant and are getting the error described in the question after rebooting your PC (or otherwise closing and reopening Pageant):

    The error can be caused by Pageant not having your GitHub SSH key actively loaded. By default, Pageant does NOT automatically load the keys from the previous session when it starts up.

    To load the key:

    1. Open Pageant. (On Windows, if Pageant is running, it'll have an icon in the system tray. Double-click that.)
    2. Click the Add Key button, and proceed to add your existing GitHub SSH key.

    To avoid this problem in the future, you can configure Pageant to automatically load your key when it starts up. (Pageant will automatically prompt you for a password if your key is password-protected.)

    Steps to do this (assuming you already have Pageant configured to run when Windows starts):

    1. Find the shortcut used by Windows to run Pageant when Windows starts. (It may be in the Startup folder, which can be opened by Start > Run > shell:startup)
    2. In the shortcut's Properties dialog, append the full path and filename of the SSH key file to the "Target" field.

    Reference and full details: http://blog.shvetsov.com/2010/03/making-pageant-automatically-load-keys.html

    0 讨论(0)
  • 2020-11-29 16:55

    Worked for me on Windows 8: GIT_SSH variable was pointing to plink.exe, Changed it in the system settings to point to the ssh binary, and that has fixed the problem. To find out full path to the ssh, run:

    where ssh
    
    0 讨论(0)
  • 2020-11-29 16:58

    To resolve this issue this was what I did.

    I was using Git Bash on Windows 10

    I started Pageant, pressed Add Key,

    navigated to C:\Users\username\.ssh folder and chose my key

    I then attempt to do a git push and it worked this time.

    0 讨论(0)
  • 2020-11-29 16:59

    I encountered this same problem, however the GIT_SSH solution appeared to work once for me. After a computer restart I realized it was something else, as I was able to clone my private repositories with no problem using Git Bash or Command Prompt, but not in Sublime Text 3 with the SublimeGit plugin. My solution was simple and is actually what @BlueRaja - Danny Pflughoeft mentioned but I thought it could use some direction ;)

    Basically you just need to edit ~/.ssh/config and ensure the username is git. You can also tell it to use a specific SSH key for Github -- My ~/.ssh/config file looks like the following:

    Host gh
        Hostname github.com
        User git
        IdentityFile ~/.ssh/github_rsa.pub
    

    I have a specific key for Github due to the number of other things I do throughout my day, but if you've only got one then it usually will be ~/.ssh/id_rsa.pub like Github explains here.

    I know everyone has a different solution, but I'll leave this here for anyone who may encounter this article without a fix. Good luck!

    0 讨论(0)
  • 2020-11-29 17:02

    On my Windows 7 machine running Github for Windows using git version 1.8.3.msysgit.0. I found that updating my system environment variable GIT_SSH to C:\Program Files (x86)\Git\bin\ssh.exe seemed to do the trick. This also fixed my issue with contacting OpenShift's git repo.

    0 讨论(0)
  • 2020-11-29 17:04

    You can create a file named ".profile" in your home directory, for me that's C:\Users\[user]

    Inside that file, put the following line of code:

    GIT_SSH="/usr/bin/ssh.exe"
    

    This will set the GIT_SSH environment variable to use the ssh client included with git.

    The .profile script gets executed when you start your Git Bash command line.

    Edit: This is my .profile. It will ask you for your password the first time you start the git command prompt, then will remember it from then on, until you reboot your computer. Very handy so you don't have to keep entering your password each time you want to do something.

    SSH_ENV="$HOME/.ssh/environment"
    GIT_SSH="/usr/bin/ssh.exe"
    
    function start_agent {
    echo "Initializing new SSH agent..."
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add;
    }
    
    # Source SSH settings, if applicable
    if [ -f "${SSH_ENV}" ]; then
    . "${SSH_ENV}" > /dev/null
    #ps ${SSH_AGENT_PID} doesn't work under cygwin
    ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
    start_agent;
    }
    else
    start_agent;
    fi
    
    0 讨论(0)
提交回复
热议问题