找不到公钥id_rsa.pub
问题:通常公钥密钥文件都在路径~/.ssh
或者/home/UserName/.ssh
下面,使用cat ~/.ssh/id_rsa.pub
就可以显示公钥。但是前几天我在配置的时候发现找不到相应文件。
解决方案:在重新生成密钥公钥的时候,显示说密钥已存在,仔细检查才发现我的公钥在/root/.ssh
路径中。
push失败
push失败时可以先用ssh -T git@github.com
检查连接,当显示"connect to host github.com port 22: Connection refused"时,可以进入.ssh
路径中检查是否存在config
文件。
以下是我的config
文件设置:
Host git.ppdaicorp.com
HostName git.ppdaicorp.com
User git
Port 22
Host github.com
HostName ssh.github.com
User git
Port 22