1 上傳項目
- 建立github倉庫
一文搞定github倉庫上傳維護 -
項目檔案夾處打開git
滑鼠右鍵git bash here即可。
- 初始化
$ git init
- 添加檔案到倉庫,.表示所有檔案,也可以指定單個檔案
- 上傳說明,引号内容自定
- 關聯遠端倉庫,遠端倉庫連結即上面建立的新倉庫位址
$ git remote add origin https://github.com/xxx/xxx.git
- 上傳到github
$ git push origin master:master
注:可能會報錯error: failed to push some refs to ‘https://github.com/xxx’,請先運作下面指令,再重複第7步
$ git pull origin master --allow-unrelated-histories
2 更新項目
- 合并遠端與本地倉庫
$ git pull origin master --allow-unrelated-histories
- 添加檔案到倉庫,.表示所有檔案,也可以指定單個檔案
- 上傳說明,引号内容自定
- 上傳到github
$ git push origin master:master