我刚刚生成了RSA密钥对,我想将该密钥添加到GitHub。
我尝试了cd id_rsa.pub和id_rsa.php,但没有成功。如何访问SSH公钥?
我刚刚生成了RSA密钥对,我想将该密钥添加到GitHub。
我尝试了cd id_rsa.pub和id_rsa.php,但没有成功。如何访问SSH公钥?
当前回答
cat~/.ssh/id_rsa.pub或cat~//ssh/id_dsa.pub
您可以通过以下操作列出所有公钥:
$ls~/.ssh/*.pub
其他回答
ssh-add用于显示公钥。
man ssh添加
-L Lists public key parameters of all identities currently repre‐
sented by the agent.
在我的Linux系统上,我使用xclip复制它
ssh-add -L | xclip
生成SSH密钥后,可以执行以下操作:
cat .ssh/id_rsa.pub |pbcopy
它会将ssh密钥复制到剪贴板中。
我的Windows使用Git Bash。
$eval$(ssh代理-s)//激活连接
一些输出
$ssh-add~/.ssh/id_rsa//添加标识
一些其他输出
$clip<~/.ssh/id_rsa.pub//这是最重要的一个。这会将密钥添加到剪贴板。回到GitHub并粘贴它,瞧!你应该很高兴去。
开放式终端nano~/.ssh/id_rsa.pub
为了给这个问题一个新的视角,如果你使用github,你可以在以下位置找到你的公钥:https://github.com/${USERNAME}.keys