ubuntu18.04安装、配置git

一、注册账号

在github官网注册账号,并新建仓库作为测试。

如何在github创建新的仓库项目

二、ubuntu安装git

sudo apt-get update
sudo apt-get install git

刚发现ubuntu18.04好像自带git?

git --version

在这里插入图片描述

二、配置git

参考在Ubuntu 18.04中安装与使用Git

git config --global user.name "你的用户名,例如github的账号"
git config --global user.email "你的邮箱,例如github中的邮件地址"
git config --list

二、使用git

如果是单纯的拷贝代码的话,是不需要初始化本地仓库的。
所以,就在需要的地方git clone就可以。
但是还有个问题,用git clone代码的速度实在太慢。
参考广大博客,一个普适的办法是:

nslookup github.global.ssl.fastly.Net
nslookup github.com

分别查看ip地址后,在下面文件的最后添加

sudo vi /etc/hosts

xxxx github.com
xxxx github.global.ssl.fastly.net

最后重启网络服务

sudo /etc/init.d/networking restart

结果是,网速确实比以前快了,但是也就只有50k/s左右。。。

发布了32 篇原创文章 · 获赞 7 · 访问量 2159

猜你喜欢

转载自blog.csdn.net/def_init_myself/article/details/105338885