首先有github和gitee账号
安装好git
user.name、 user.email:输入gitee账号密码
1.配置用户名
ckq@ckq:~/git$ git config --global user.name "。。。。。。。"
2.配置git邮箱
ckq@ckq:~/git$ git config --global user.email "。。。。。。。"
3.创建公钥
ckq@ckq:~/git$ ssh-keygen -C "邮箱。。。。" -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ckq/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ckq/.ssh/id_rsa.
Your public key has been saved in /home/ckq/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:。。。。。。。。。。。。。。。。。。。。。。。(删除)
The key's randomart image is:
+---[RSA 2048]----+
|.Eo |
|o..o |
| += o |
|.=o+ + |
|Bo..= . S |
|**.+ + + |
|Oo*oo.= . |
|BBoo=. . |
|+o*+ |
+----[SHA256]-----+
4.gitee添加公钥
将目录下的.ssh/id_rsa.pub里的内容全部复制。登录gitee网站在设置中选择SSH公钥添加公钥内容
ckq@ckq:~$ cd /home/ckq/.ssh/
ckq@ckq:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
ckq@ckq:~/.ssh$ cat id_rsa.pub
...................
..............
。。。。。。。
将其复制到这里
5.key加入到ssh-agent
ckq@ckq:~/git$ ssh-add ~/.ssh/id_rsa
Identity added: /home/ckq/.ssh/id_rsa (/home/ckq/.ssh/id_rsa)
6.初始化git仓库
ckq@ckq:~/git$ git init
Initialized empty Git repository in /home/ckq/git/.git/
7.测试一下SSH Key
ckq@ckq:~/git$ ssh -T git@gitee.com
The authenticity of host 'gitee.com ()' can't be established.
ECDSA key fingerprint is SHA256:...............................
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'gitee.com,' (ECDSA) to the list of known hosts.
Hi XXXXXXXXXX! You've successfully authenticated, but GITEE.COM does not provide shell access.
8.克隆项目代码
ckq@ckq:~/git$ git clone git@gitee.com:kaiqichen/FairMOT.git
Cloning into 'FairMOT'...
remote: Enumerating objects: 422, done.
remote: Counting objects: 100% (422/422), done.
remote: Compressing objects: 100% (205/205), done.
remote: Total 422 (delta 207), reused 422 (delta 207), pack-reused 0
Receiving objects: 100% (422/422), 62.98 MiB | 323.00 KiB/s, done.
Resolving deltas: 100% (207/207), done.
Checking connectivity... done.
clone 成功 速度比之前快了很多!!!!