安装和初始化
配置全局用户名和电子邮件地址
1
2
| $ git config --global user.name "yourname"
$ git config --global user.email "yourname@mail.com"
|
为特定版本库配置用户名和电子邮件
1
2
3
| $ cd /path/to/repo
$ git config user.name "yourname"
$ git config user.email "yourname@mail.com"
|
查看配置
1
2
3
| $ git config --global --list
user.name=yourname
user.email=yourname@mail.com
|
在命令行中使用不同的颜色显示不同类型的内容,需要设置color.ui
的值为auto
或者always
1
| $ git config --global color.ui "auto"
|
初始化新版本库
1
2
3
4
5
| $ mkdir /path/to/repo
$ cd /path/to/repo
$ git init
$ git add .
$ git commit -m "initial import"
|
克隆版本库
1
| $ git clone <repository url>
|
将目录中的内容纳入到git版本控制
1
2
3
4
| $ cd /path/to/existing/directory
$ git init
$ git add .
$ git commit -m "initial import of some project"
|