1. 从官网下载Git到本地电脑
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
> git --version
git version 2.27.0.windows.1
2. 使用git-bash/terminal/power-shell创建ssh-key
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
按照指示前进,可能会让输入passphase,相当于又一层安全密码
3. 复制创建的ssh public key
Mac
cat ~/.ssh/id_rsa.pub | clip
Windows
cat C:\Users\username/.ssh/id_rsa.pub | clip
4. 把密码复制到GitHub/GitLab里
GitLab
头像 -> Settings -> 左侧面SSH Keys
GitHub
头像 -> Settings -> 左侧面SSH and GPG Keys -> New SSH Keys
网友评论