1. 程式人生 > >git 如何用指令建立遠端倉庫

git 如何用指令建立遠端倉庫

建立倉庫不一定要登入github網站,我們實際上可以在本地通過命令列進行操作

git init          //git add . 和 git commit 也是必要的, 這樣做會生成master主分支,否則
                  //後續push會有報錯 error: src refspec master does not match any.
curl -u '使用者名稱' https://api.github.com/user/repos -d '{"name":"倉庫名"}'
git remote add origin https://github.com/使用者名稱/倉庫名.git
                 //或者使用ssh,避免輸入密碼 
                 //git remote add
origin [email protected]:使用者名稱/倉庫名.git git push origin master