赞
踩
输入指令ssh -T git@github.com
测试SSH链接,出现如下报错:
git@github.com: Permission denied (publickey,password,keyboard-interactive).
git@github.com: Permission denied (publickey).
git@github.com's password:
,但是即是你输入的是正确的密码,依旧提示Permission denied, please try again.
。在网上搜索相关解决方案,可以查到基本上都是说公钥没有配置好,操作如下:
ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "your_email@example.com"
;ssh-agent bash
、ssh-add ~/.ssh/id_rsa.github
;touch ~/.ssh/config
;settings
-> SSH and GPG keys
-> New SSH key
。上述详细操作方法可以查阅其他博文,因为这不是本文的重点,很多人可能已经正确的配置了SSH keys,但已经无法正常链接SSH,可以看下面的解决方法。
要测试通过 HTTPS 端口的 SSH 是否可行,请运行以下 SSH 命令:
ssh -T -p 443 git@ssh.github.com
如果你看到:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
那么说明可以通过 HTTPS 443端口建立的 SSH 连接,接下来编辑~/.ssh/config
文件(C:\Users\Admin\.ssh\config
),若没有该文件,可以输入如下指令新建一个:
touch ~/.ssh/config
把下面内容填入该文件:
Host github.com
Port 443
HostName ssh.github.com
User git
IdentityFile ~/.ssh/id_rsa.github
需要注意的是IdentityFile
字段的值要是.ssh
文件夹中的GitHub公钥文件名。再输入:
ssh -T git@github.com
将看到:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
说明问题已经解决了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。