Github新建SSH Key
一,先在本机生成 SSH key 推荐用 ed25519,短、安全、GitHub 首选。 1 ssh-keygen -t ed25519 -C "your_email@example.com" 一路回车即可,默认会生成在: 1 2 ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub 如果你已经有这个文件,说明之前生成过,可以直接用,不用再建。 二,确认 ssh-agent 正在运行并加载 key 1 2 eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 三,把公钥复制出来 复制的是 .pub 文件内容。 Linux / WSL: 1 cat ~/.ssh/id_ed25519.pub macOS: 1 pbcopy < ~/.ssh/id_ed25519.pub Windows PowerShell: 1 Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub 复制整行,以 ssh-ed25519 开头的那一串。 四,在 GitHub 新建 Key 网页操作路径: GitHub -> 右上角头像 -> Settings -> SSH and GPG keys -> New SSH key ...