MacOS 本地生成SSH key并关联Github

生成一个名字叫key_github的ssh key pair,目录在~/.ssh/,文件名可以按自己喜好修改,邮箱用自己的

复制代码
ssh-keygen -t rsa -b 4096 -C "xxxx@email.com" -f ~/.ssh/key_github

生成完记得激活加入ssh agent:

复制代码
eval "$(ssh-agent -s)"
你会看见提示:
Agent pid 12345

将生成的ssh 加入agent:

复制代码
ssh-add ~/.ssh/key_github

这时候~/.ssh 目录下应该会有两个文件,key_github 和 key_github.pub,用textEditor打开pub文件,复制里面的内容,

登陆github,右上角头像,点击settings,在左侧选择SSH and GPG keys,右边 add new ssh keys,粘贴刚才复制的内容,save

这样github获取了共钥,而本地macbook保留着私钥,就可以ssh连接了

打开terminal测试连接

复制代码
ssh -T git@github.com 

提示
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.
相关推荐
niucloud-admin9 小时前
JAVA V6 多商户商城 开发文档——job 计划任务开发
java·python·github
峰向AI13 小时前
Notion 太贵?这个 40K Star 的开源知识库,让你零成本搭建团队 wiki
github
逛逛GitHub14 小时前
37K Star 的 GitHub 开源项目开放 AI 网关,10 人团队免费用。
github
FuckPatience16 小时前
Git:the remote end hung up unexpectedly,Everything up-to-date
github
sysinside17 小时前
如何创建可引导的 macOS Golden Gate 27 安装介质
macos
szephyr17 小时前
GitHub Actions 实战:给个人项目接上免费的自动部署流水线
ci/cd·github·devops·自动化部署·github actions
m4Rk_17 小时前
【论文阅读】Agent 记忆机制(67):MemPO——用记忆级信用分配训练 Agent 主动管理长程上下文
论文阅读·人工智能·学习·开源·github
parksben19 小时前
OpenSider:让浏览器驱动 Agent
开源·github·agent
ShineWinsu19 小时前
对于Git:远程操作的超详细保姆级解析
linux·git·gitee·github·远程仓库·分布式版本控制系统·远程操作
Gu0Qiang20 小时前
从 0 到 1 打造 AI 提示流编排器:条件分支路由、Kahn 图剪枝与 HTTP 节点实战(开源系列 06)
人工智能·github