user@host:~/warehouse$ git clone[email protected]:username/repo.git
Cloning into 'repo'...
The authenticity of host 'gitee.com (180.76.198.225)' can't be established.
ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
yes
Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (4/4), done.
user@host:~/warehouse$ ls repo
# 注意要输入自己的邮箱,然后一路回车,使用默认值即可
ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file inwhich to save the key (/home/user/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa
Your public key has been saved in /home/user/.ssh/id_rsa.pub
The key fingerprint is: SHA256:sepKZUwKIXjJxYcot49tvOW+Aa+pEhdsRqVDFSmgQZo [email protected]
The key's randomart image is: ...
user@host:~/.ssh$ ll
-rw------- 1 user user 2602 Jul 9 16:23 id_rsa
-rw-r--r-- 1 user user 571 Jul 9 16:23 id_rsa.pub
-rw-r--r-- 1 user user 142 Jun 5 10:34 known_hosts
注意事项:
提交时要注意,如果我们之前设置过全局的 name 和 e-mail,这两项配置需要和远程仓库上配置的用户名和邮箱一致,否则会出错。或者从来没有设置过全局的 name 和 e-mail,那么我们第一次提交时也会报错。这就需要我们重新配置下了,同样要注意需要和远程仓库上配置的用户名和邮箱一致。
user@host:~/warehouse$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file inwhich to save the key (/home/user/.ssh/id_rsa): /home/user/.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 /home/user/.ssh/id_rsa
Your public key has been saved in /home/user/.ssh/id_rsa.pub
The key fingerprint is: SHA256:umGEFdHZF+/63LHSkHvxHqO7Ay1RFEBrq0tNBvUyPzM user@host
The key's randomart image is: ...