gitHub添加公钥

gitHub添加公钥

  1. gitHub是通过SSH公钥连接到现有仓库的
  2. 设置SSH Key

    ssh-keygen -t rsa -C "your_email@example.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/mouMiFan/.ssh/id_rsa): //Enter 回车
    Enter passphrase (empty for no passphrase): //密码
    Enter same passphrase again: //密码
    

    结果:

    Your identification has been saved in /Users/mouMiFan/.ssh/id_rsa.
    Your public key has been saved in /Users/mouMiFan/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:OkZCZO3AEOTsBILDqS/RZQhmr/YW2KVMExtdFOHmZh0 your_email@example.com
    The key's randomart image is:
    +---[RSA 2048]----+
    |*==B+.o=o        |
    |**ooO.o          |
    |.o+B.+ o E       |
    |ooB.+ + . .      |
    | *.=. .+S.       |
    |o o .oo.         |
    | . o  +          |
    |  .  . .         |
    |                 |
    +----[SHA256]-----+
    

    在~/.ssh 文件夹中便生成了文件: id_rsa 文件是私有密钥,id_rsa.pub 是公开密钥。

  3. 查看公钥

    cat ~/.ssh/id_rsa.pub
    
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4y3M40TOWuHhEraguOtunMtzywSre2ZcsvFUIAQ7DDPkp+pX4Su0RpYaqIvKm4JHy2f3+IsnlbThAJQkbJ4UC8YufHsk7h+bvjnb7P4lQGvbgHTu4zt2xrOBc3XiJrO+bCJLHwzdaVR8qE+uzwEaSE5b+VqH4xZt58yOBV4e2/fCBvlSnOqwuCMdaRNi2HnB1C+TEoEWFfJQxrgFWW1eEwbfwA/g4bkL9jNz8VVPnYRI6kZiVHIA6SLHmVzDdVCy0WgqKFUIkUVPSviahWdFV73IyMIvGt+s1FtE90iKIVH4SBIUrhhbxgHgX6Vgpv6qo2o1QJUqMW23cGwUfALrL your_email@example.com
    
  4. 提交到gitHub

    打开 https://github.com/settings/ssh,点击New SSH Key按钮,粘贴上面的公钥保持即可

posted @   阿克西斯教成员污米饭  阅读(3438)  评论(0编辑  收藏  举报
编辑推荐:
· 35岁程序员的中年求职记:四次碰壁后的深度反思
· 继承的思维:从思维模式到架构设计的深度解析
· 如何在 .NET 中 使用 ANTLR4
· 后端思维之高并发处理方案
· 理解Rust引用及其生命周期标识(下)
阅读排行:
· 35岁程序员的中年求职记:四次碰壁后的深度反思
· ShadowSql之.net sql拼写神器
· 使用MCP C# SDK开发MCP Server + Client
· 感觉程序员要被 AI 淘汰了?学什么才有机会?
· MQTT协议发布和订阅的实现,一步步带你实现发布订阅服务。
点击右上角即可分享
微信分享提示