我正在尝试使用 ssh key
从 bitbucket
克隆 repo。
我用 ssh-keygen -t rsa
生成了 key ,我使用的名称是 abc
和 abc.pub
。
我无法连接然后我尝试调试
ssh -v git@bitbucket.org
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/vagrant/.ssh/id_rsa
debug1: Trying private key: /home/vagrant/.ssh/id_dsa
debug1: Trying private key: /home/vagrant/.ssh/id_ecdsa
debug1: Trying private key: /home/vagrant/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/.ssh
因此我看到 ssh 仅从名称为 id_rsa
对吗?
我记得我的家用电脑上有一些其他的 key 名称,系统能够检测到它。
我将 abc 重命名为 id_rsa,它起作用了
最佳答案
尝试
ssh -v git@bitbucket.org -i /path/to/abc
手册页说
-i identity_file Selects a file from which the identity (private key) for public
key authentication is read. The default is ~/.ssh/identity for protocol version 1,
and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2.
Identity files may also be specified on a per-host basis in the configuration
file. It is possible to have multiple -i options (and multiple identities
specified in configuration files). ssh will also try to load certificate
information from the filename obtained by appending -cert.pub to identity
filenames.
关于linux - ssh key 中的命名是否重要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22370256/