git --version
如果命令找不到就要安装。
2.sudo apt-get install git
安装git
3.git config --global user.name "tongfan"
配置user.name
4.git config --global user.eamil "tongfan@followme.com"
配置你的Git上注册的邮箱地址这个一定要确定,ssh通讯时要用到。
5.ssh-keygen -C 'tongfan@followme.com' -t rsa
一直回车直到完成。生成RSA公钥:id_rsa.pub和私钥:id_rsa
6.把id_rsa.pub公钥的内存copy
7.Settings->SSH and GPG keys->New SSH Keys
这里有github.com为列子:https://github.com/settings/profile
8.测试设置是否成功。
root@ubuntu:~/code# git clone git@github.com:micro/examples.git
Cloning into 'examples'...
remote: Counting objects: 301,done.
remote: Total 301 (delta 0),reused 0 (delta 0),pack-reused 301
Receiving objects: 100% (301/301),85.78 KiB | 28.00 KiB/s,done.
Resolving deltas: 100% (80/80),done.
Checking connectivity... done.
原文链接:https://www.f2er.com/ubuntu/354083.html