Git 初始设置

来源:互联网 发布:软件编程培训机构地址 编辑:程序博客网 时间:2024/05/22 12:15

Git 初始设置

本地计算机里安装的 Git 初始设置
1. 设置姓名和邮箱地址
$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "your_email@example.com"

~/.gitconfig 文件内容
[user]
    name = Firstname Lastname
    email = your_email@example.com
想更改这些信息时,可以直接编辑这个设置文件。

strong@foreverstrong:~$ git config --global user.name "your_email"strong@foreverstrong:~$ git config --global user.email "your_email@163.com"strong@foreverstrong:~$ strong@foreverstrong:~$ cat ~/.gitconfig [user]email = your_email@163.comname = your_emailstrong@foreverstrong:~$ 


2. 提高命令输出的可读性
将 color.ui 设置为 auto 可以让命令的输出拥有更高的可读性。
$ git config --global color.ui auto

~/.gitconfig 文件内容
[color]
    ui = auto

strong@foreverstrong:~$ git config --global color.ui autostrong@foreverstrong:~$ strong@foreverstrong:~$ cat ~/.gitconfig [user]email = your_email@163.comname = your_email[color]ui = autostrong@foreverstrong:~$ 


references
(日) 大塚弘记 著, 支鹏浩, 刘斌 译. GitHub入门与实践[M]. 北京:人民邮电出版社, 2015. 1-255
原创粉丝点击