1、先在遠程倉庫(如github)創建項目,為了避免錯誤,不要初始化 README, license, 或者gitignore文件 .
2、打開Terminal終端
3、切換到你的本地項目目錄
4、初始化本地倉庫
git init
5、添加文件到本地倉庫
git add .
6、提交文件
git commit -m "First commit"
7、到遠程倉庫的頁面上,復制倉庫地址 (筆者以配置好ssh,故復制ssh形式的倉庫地址)
8、添加遠程倉庫地址到本地倉庫
git remote add origin {遠程倉庫地址}
# Sets the new remote
git remote -v
# Verifies the new remote URL
9、push到遠程倉庫
git push -u origin master
