linux下获取git的ssh公钥

linux下获取git的ssh公钥

一、查询~/.ssh目录下是否存在SSH远程文件

cd ~/.ssh

二、查看文件是否存在

Ls(需要找一对以id_dsa或id_rsa的文件,.pub文件是公钥

1、设定ssh文件
(1)加入用户的email、name等基本信息
Git config --global user.name “xxxx”
Git config --global user.email “xxxx”
(2)如果查找不到,.ssh目录,通过运行ssh-keygen程序创建SSH文件
Ssh-keygen -t rsa -C “[email protected]
(3)查看ssh公钥
Cat ~/.ssh/id_rsa.pub
(4)将ssh配置到github

2、使用命令ssh -add时,Could not open a connection to your authentication agent
运行命令ssh-agent bash,再运行ssh-add

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章