Skip to content

Github

Github SSH

MacOS

bash
# 生成本地密钥
ssh-keygen -t ed25519 -C "elvea.huang@gmail.com" -f ~/.ssh/github_id_ed25519
# 查看生成的本地私钥
cat ~/.ssh/github_id_ed25519
# 查看生成的本地公钥
cat ~/.ssh/github_id_ed25519.pub
# 将公钥内容复制出来,在Github->Settings->SSH and GPG keys中新建SSH Key,填入复制出来的公钥。
# 测试是否已经成功
ssh -T git@github.com

Windows

bash
ssh-keygen -t ed25519 -C "elvea.huang@gmail.com"

Github Actions

SFTP-Deploy-Action & ssh-action

bash
# 生成本地密钥
ssh-keygen -t ed25519 -C "elvea.huang@gmail.com"
# 查看生成的本地私钥
cat ~/.ssh/id_ed25519
# 查看生成的本地公钥
cat ~/.ssh/id_ed25519.pub
#
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys