-
注册Github账户 https://github.com/
-
安装Git并验证
sudo apt-get install git
git --version
3.配置Git全局用户名和邮箱,并验证
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --list
4.生成SSH密钥(默认保存在 ~/.ssh)
ssh-keygen -t ed25519 -C "your.email@example.com"
5.查看公钥内容,并复制
cat ~/.ssh/id_ed25519.pub
7.将 SSH 密钥添加到 GitHub
-
登录 GitHub,点击右上角头像 → Settings → SSH and GPG keys → New SSH Key。
-
粘贴复制的公钥,保存。
8.测试SSH连接
ssh -T git@github.com
看到 You've successfully authenticated 表示成功。