起步

1 安装

Git 完美支持所有平台。

2 帮助

$ git help
$ git --help
$ man git

谷歌一下也很方便。

3 初始

git init 能让当前目录成为 git 仓库,不过此时并没有起点。

4 配置

git config 是 Git 的配置工具,它分布在三种位置:

  • /etc/gitconfig :系统级的通用配置,用 git config --system 读写。
  • ~/.gitconfig~/.config/git/config :用户级的通用配置,用 git config --global 读写。
  • .git/config :仓库级的私用配置,用 git config 读写。

命令 git config --list 可以列出所有配置信息,自上而下依次执行,如有相同条目,后者覆盖前者。

优先设置昵称和邮箱。

$ git config --global user.name "Chittle Skuny"
$ git config --global user.email chittleskuny@gmail.com

强烈建议每个仓库都指定昵称和邮箱,避免暴露自己的其它身份。