码迷,mamicode.com
首页 > 其他好文 > 详细

Git 配置环境

时间:2019-12-14 17:26:42      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:分支   scm   pac   不同   com   apt   默认值   http   line   

安装

在Fedora/CentOS下安装

$ sudo yum install git

在Debian/Ubuntu Linux下载安装

$ sudo apt-get install git

Windows/Mac下要先下载,下载地址https://git-scm.com/downloads

在gui环境下安装,安装过程略。

设置环境变量

1
2
3
4
5
6
$ git config --global user.name "wsh"
$ git config --global user.email "tech@wangshenghua.com"
$ git config --global push.default simple
$ git config --global color.ui.auto
$ git config --global color.branch auto
$ git config --global color.status auto

$ git config --global user.name "wsh"   设置用户名

$ git config --global user.email "tech@wangshenghua.com"  设置email

$ git config --global push.default simple 设置工作流程模式

simple表示在中央仓库工作流程模式下,拒绝推送到上游与本地分支名字不同的分支。也就是只有本地分支名和上游分支名字一致才可以推送,就算是推送到不是拉取数据的远程仓库,只要名字相同也是可以的。在git 2.0中,simple将会是push.default的默认值。

$ git config --global color.ui.auto      设置ui颜色自动高亮
$ git config --global color.branch auto  设置分支颜色自动高亮
$ git config --global color.status auto 设置状态颜色自动高亮

查看设置的环境变量

$ git config --list

 

Git 配置环境

标签:分支   scm   pac   不同   com   apt   默认值   http   line   

原文地址:https://www.cnblogs.com/max-hou/p/12040231.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!