如何用命令將本地項目上傳到git

來源:互聯網
上載者:User

標籤:--   www   .com   本地   cad   class   不為   hub   版本   

1、(先進入專案檔夾)通過命令 git init 把這個目錄變成git可以管理的倉庫

git init

2、把檔案添加到版本庫中,使用命令 git add .添加到暫存區裡面去,不要忘記後面的小數點“.”,意為添加檔案夾下的所有檔案

git add .

3、用命令 git commit告訴Git,把檔案提交到倉庫。引號內為提交說明

git commit -m ‘first commit‘

4、關聯到遠程庫

git remote add origin 你的遠程庫地址

如:

git remote add origin https://github.com/cade8800/ionic-demo.git

5、擷取遠程庫與本地同步合并(如果遠程庫不為空白必須做這一步,否則後面的提交會失敗)

git pull --rebase origin master

6、把本地庫的內容推送到遠程,使用 git push命令,實際上是把當前分支master推送到遠程。執行此命令後會要求輸入使用者名稱、密碼,驗證通過後即開始上傳。

git push -u origin master

*、狀態查詢命令

git status

備:詳細請參考 http://www.cnblogs.com/tugenhua0707/p/4050072.html

 

如何用命令將本地項目上傳到git

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.