Git SSH配制
- 检测是否已存在SSH配制文件
cd ~/.ssh
如果没有ssh文件将提示 No such file or directory。如果有则进入~/.ssh路径下(ls查看当前路径文件,rm * 删除所有文件)
cd ~/.ssh
ls
rm *
- 生成ssh key
$ ssh-keygen -t rsa -C "xxx@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/leix/.ssh/id_rsa): leix.ssh
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in leix.ssh.
Your public key has been saved in leix.ssh.pub.
The key fingerprint is:
SHA256:V8fcOSNKAW37ulD0WyG4WnDd7yRZBiPL5jT4WDDIGQc xxx@163.com
The key's randomart image is:
+---[RSA 2048]----+
| .E**.. o |
| +. B+=.+.|
| .o=X++*+|
| =X+oo+=|
| S o=+.o.o|
| .+ .o+ |
| o .. .|
| .. |
| .. |
+----[SHA256]-----+
这样ssh key 就生成成功了
- 在github.com上配制ssh key
在github中点击“setting -> SSH and GPG Keys -> New SSH Key”
把xxx.ssh.pub文件中的内容粘贴到输入区中,点击“Add SSH Key”,完成配制
然后通过ssh地址clone项目到本地,同样使用git push来推送修改
网友评论