用户身份配置
安装好Git后的第一步是设置用户名和电子邮件地址。这一步是很重要的,因为以后这将作为你每一次提交的个人信息,写入所创建的提交中,不可更改。
git config --global user.name "velscode"
git config --global user.email "velscode@gmail.com"
其中global
开关为全局设置,加入这个参数,只需要设置一次即可。
个人编辑器
git在需要输入一些消息的时候会使用到,如果不配置,很可能会出现异常情况(需要编辑的时候,操作被提前终止)
如果是windows上建议使用Notepad++
git config --global core.editor "'E:\ProSoftware\Notepad++\notepad++.exe' -multiInst -nosession"
中间是Notepad++的安装地址
如果是Linux,可以使用Emacs
$ git config --global core.editor emacs
检查个人设置
如果要查看你的设置,可以通过git config -list
命令列出所有的设置
λ git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
……
user.name=velscode
user.email=velscode@gmail.com
core.editor='E:\ProSoftware\Notepad++\notepad++.exe' -multiInst -nosession
也可以通过git config <key>
获取某个键值的值
λ git config user.name
velscode
获取帮助
如果在使用过程中需要帮助,可以输入以下指令来查看命令的保住页面
$ git help <verb>
$ git <verb> --help
$ man git <verb>
$ git help config