idea 使用git管理專案, window配置和第一次上傳專案到碼雲
阿新 • • 發佈:2018-12-15
首先測試git是否安裝成功 在cmd中輸入命令
git --version
如果成功會出現版本資訊
註冊申請碼雲賬戶碼雲註冊網址,新建遠端服務專案倉儲,獲得ssh公匙複製留作備用。
首先初始化git
git init
檢視提交到git上的檔案,並檢視是否提交成功,成功後git status為綠色。
git add .
git status
git commit -am "first commit project" //提交到git服務 -am 為全部提交 ,first commit project為第一次提交的備註
檔案commit到本地git之後需要push到碼雲服務上執行
git remote add origin [email protected]:XXXXXXXXX//:加申請的公匙 連線到碼雲伺服器端
連線後把把本地服務推動到遠端
git push -u origin master
出現錯誤提示,提示需要git pull 更新服務上的程式碼
Enter passphrase for key '/c/Users/Thinkpad/.ssh/id_rsa': To gitee.com:FangHuaShiJie/leaning_newmmall.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '
[email protected]:XXXXXXX/XXXXXXXXX.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git pull
git push -u -f origin master //執行強制重新整理
會提示更新成功,此時可以再碼雲檢視是否上傳成功