ssh-keygen -t rsa -C "你的GitHub邮箱"
一路回车,生成 ~/.ssh/id_rsa
和 id_rsa.pub
打开 C:\Users\你的用户名\.ssh\id_rsa.pub
文件
复制内容
登录 GitHub → 右上角头像 → Settings
→ SSH and GPG keys
→ New SSH key
→ 粘贴保存
git remote set-url github [email protected]:226211/niubi.git
ssh -T [email protected]
第一次运行会提示输入 yes
,然后看到:
Hi 226211! You've successfully authenticated...
git push github master
SSH 一旦设置好,今后推送/拉取都不需要输账号密码,且不会受 HTTPS 网络限制影响。