一.安装
1.Mac安装
安装homebrew->用homebrew安装Git
命令行下:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
2.其他安装可见
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137396287703354d8c6c01c904c7d9ff056ae23da865a000
二.配置
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
三.创建版本库
1.选择合适的地方,建立空目录
$ mkdir learngit
$ cd learngit
$ pwd
pwd显示当前目录。注意win系统路径中不要有中文
2.把此目录变成Git可管理的仓库
$ git init
3.把文件放到Git仓库需要两步 : add 和commit
$ git add readme.txt
$ git commit -m "wrote a readme file"