一氣呵成的代碼提交步驟皆辽,避開你所遇到的坑柑蛇。
轉(zhuǎn)載請注明出處:Vincent Blog‘s
向GitHub提交代碼首先我們要注冊一個GitHub賬號,這個就不掩飾了驱闷,很簡單一步一步來就OK耻台。
建立倉庫
登錄你的賬號,創(chuàng)建倉庫repository空另,英語不錯的同學可以看這個<a >https://help.github.com/articles/create-a-repo</a>官方的幫助文檔,點擊New repository
進入界面后填寫相關(guān)信息粘我,如下:
下載Git
點這里<b><a >Git</a></b>進入官方下載,安裝成功后在桌面右擊你的鼠標會出現(xiàn)如下兩個表示成功:
以下進入命令行
在初始化版本庫之前,先要確認認證的公鑰是否正確痹换,這里就不演示公鑰的創(chuàng)建和添加征字,不會的同學自己可以去查一下資料,如下:
ssh -T git@github.com
顯示如上表示正確
- clone倉庫娇豫,類型SVN的CheckOut
git clone https://github.com/vincentljdong/TabDemo.git(后面url改為你自己的)
-
提交文件(依次執(zhí)行如下命令)
git add . git commit -m 'first_commit' git remote add origin https://github.com/vincentljdong/TabDemo.git git push origin master
如果執(zhí)行g(shù)it remote add origin https://github.com/vincentljdong/TabDemo.git匙姜,出現(xiàn)錯誤:
fatal: remote origin already exists
接著執(zhí)行
git remote rm origin
git remote add origin https://github.com/vincentljdong/TabDemo.git
如果在執(zhí)行g(shù)it push origin master時,不出意外會直接彈出對話框需要你輸入賬號密碼等待提交成功后就OK了冯痢,如果報錯:
error:failed to push som refs to.......
則執(zhí)行以下命令:
git pull origin master
好了氮昧,這篇文章就到這里,如果有不懂的同學可以留言浦楣。
<b><i>聯(lián)系方式</i>:lijiandongv@163.com</b> 有什么問題或者建議歡迎留言到我的郵箱
每日一碗雞湯
<b>不要羨慕別人袖肥,你的劣勢可能是你最大的優(yōu)勢。</b>