Git SSH Keys简易配置

AlanCorn2021-7-22个人配置Git SSH

简易配置过程

官方教程见Github SSH keyopen in new window

配置步骤

  1. email与username配置

    git config --global user.name "yourname"
    git config --global user.email "youremail@163.com"
    
  2. 生成SSH密钥

    ssh-keygen -t ed25519 -C "your_email@example.com"
    

    输入保存位置与密码(可选)

  3. 添加密钥到ssh代理

# 在后台启动ssh代理

  1. 在Github网站上配置公钥

    进入Settings/SSH and GPG keys,点击New SSH Key,cat查看公钥(id_rsa.pub)并复制上去

  2. 验证是否能够连接到Github

    ssh -T git@github.com
    

注意

  1. 在代理环境下,可能会得到下面这样的报错

官方文档:在 HTTPS 端口使用 SSHopen in new window

Last Updated 2023-02-26 10:11:22