標籤:倉庫 help 分支 info 終端 hang may image bubuko
上傳項目到gitHub
建立好後開始提交本地項目代碼:
選中VCS選中圖中的按鈕:
然後再選中Src點中add按鈕:
然後點中commit Directory後開啟終端進行項目根目錄下鍵入以下 命令:git remote add origin [email protected]:codegeekgao/Test.git(這裡我寫的自己的github地址,這裡可以改成你自己的github項目)git push -u origin master //將本地倉庫的東西提交到地址是origin的地址,master分支下
可能出現的報錯異常
提示出錯資訊:fatal: remote origin already exists. 解決辦法如下:
然後再次輸入git remote add origin [email protected]:codegeekgao/Test.git
git push -u origin master
然後會報以下錯誤:
! [rejected] master -> master (fetch first)error: failed to push some refs to '[email protected]:qzmly100/repository-.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
這是因為:
遠程分支上存在本地分支中不存在的提交,往往是多人協作開發過程中遇到的問題,可以先fetch再merge,也就是pull,把遠程分支上的提交合并到本地分支之後再push。
如果你確定遠程分支上那些提交都不需要了,那麼直接git push origin master -f,強行讓本地分支覆蓋遠程分支.
上傳項目到gitHub