首页 > 代码库 > Ubuntu git安装和使用

Ubuntu git安装和使用

  1. 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

标题填邮箱名,Key填is_rsa.pub的内容。

技术分享


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.


本文出自 “Ubuntu1604安装golang” 博客,请务必保留此出处http://terrytong914.blog.51cto.com/2081604/1906028

Ubuntu git安装和使用