Git使用技巧(1)-- 配置【持续更新】

配置名字和邮箱

git config --global user.name "Your Name"
git config --global user.email "email@example.com"

 

 

因为Git是分布式版本控制系统,所以,每个机器都必须自报家门:你的名字和Email地址。你也许会担心,如果有人故意冒充别人怎么办?这个不必担心,首先我们相信大家都是善良无知的群众,其次,真的有冒充的也是有办法可查的。

注意git config命令的--global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。

让Git显示颜色

git config --global color.ui true

 

配置别名

$ git config --global alias.st status

$ git config --global alias.br branch

$ git config --global alias.last 'log -1'

 

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

 

配置忽略文件权限的更改

$ git config core.filemode false

 

设置不用每次都输入 账号密码

git config --global credential.helper store

然后,下次再输入一次 账号密码 就可以了

posted @ 2017-02-04 22:05  shifu204  阅读(208)  评论(0编辑  收藏  举报