注:本文主要介绍Linux环境下git的使用,Windows下搭建好git环境后适用。 国内使用github可能需要能连接外网
安装git
使用Linux的包管理器
sudo apt install git
安装后配置
查看所有已经写好的配置
可以在终端直接展示出来
git config --global --list
也可以使用默认的vim查看
git config --global --edit
配置代理
注: 命令中<>包括的部分要替换成相应格式的内容
git config --global http.proxy <yourip:port>
git config --global https.proxy <yourip:port>
配置默认用户名和邮箱
git config --global user.name <username>
git config --global user.email <email>
新手必记git命令
下载一个仓库
使用git程序,传入clone命令,后面加上仓库的地址即可下载你想要下载的仓库。
git clone <repository_address>
例如下载我的DUI库的源码
git clone https://github.com/Python-Lettle/DUI.git
上传修改好的代码
在上传之前记得先查看一下你的更改是否符合你的预期
git status
随后便可以push你的更改了
git add .
git commit -m "<commit name>"
git push