先在目标服务器上生成公钥 邮箱随便写
[root@izbp13u71xuet46jj3uqfnz ~]# ssh-keygen -t rsa -C "1326944332@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:gTyXxgWMuUWjVncaphK8CJBB6tqOgPv4XXaf6CCVmyM 1326944332@163.com
The key's randomart image is:
+---[RSA 2048]----+
|+= ..==.= . |
|o . .+*oB + |
|. . .B+B . |
|. ..o* . |
| . o S |
|o. . o |
|+ . E B . |
|.= . = + o . |
|+o+ . .o o |
+----[SHA256]-----+
[root@izbp13u71xuet46jj3uqfnz ~]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYkcma063bxfHiaKBEmg8/p8yc2jfa7VX2W2e+fKRNO4TmrfXGARdiYq9sV/6xJGXdxMgIRXV0OUNDDc3.......
将公钥复制到gitee的公钥管理,并启用此公钥
然后就可以以ssh模式拉取代码了