日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

github 使用总结-----转

發布時間:2025/4/16 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 github 使用总结-----转 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉自:?http://blog.csdn.net/hao1056531028/article/details/7767567

?

1.創建一個新的repository:

先在github上創建并寫好相關名字,描述。

$cd ~/hello-world?? ? ? ?//到hello-world目錄

$git init? ? ? ? ? ? ? ? ? ? ?//初始化

$git add .?? ? ? ? ? ? ? ? ? //把所有文件加入到索引(不想把所有文件加入,可以用gitignore或add 具體文件)

$git commit?? ? ? ? ? ? ? //提交到本地倉庫,然后會填寫更新日志(?-m “更新日志”也可)

$git remote add origin git@github.com:WadeLeng/hello-world.git?? ? ? ?//增加到remote

$git push origin master?? ?//push到github上

2.更新項目(新加了文件):

$cd ~/hello-world

$git add .?? ? ? ? ? ? ? ? ?//這樣可以自動判斷新加了哪些文件,或者手動加入文件名字

$git commit?? ? ? ? ? ? ?//提交到本地倉庫

$git push origin master?? ?//不是新創建的,不用再add 到remote上了

3.更新項目(沒新加文件,只有刪除或者修改文件):

$cd ~/hello-world

$git commit -a?? ? ? ? ?//記錄刪除或修改了哪些文件

$git push origin master??//提交到github

4.忽略一些文件,比如*.o等:

$cd ~/hello-world

$vim .gitignore?? ? //把文件類型加入到.gitignore中,保存

然后就可以git add . 能自動過濾這種文件

5.clone代碼到本地:

$git clone?git@github.com:WadeLeng/hello-world.git

假如本地已經存在了代碼,而倉庫里有更新,把更改的合并到本地的項目:

$git fetch origin?? ?//獲取遠程更新

$git merge origin/master?//把更新的內容合并到本地分支

6.撤銷

$git reset

7.刪除

$git rm ?*?// 不是用rm

//------------------------------常見錯誤-----------------------------------

1.$ git remote add?origin git@github.com:WadeLeng/hello-world.git

?

?錯誤提示:fatal: remote origin already exists.

?解決辦法:$ git remote rm origin

?然后在執行:$ git remote add origin git@github.com:WadeLeng/hello-world.git?就不會報錯誤了

?2.?$ git push origin master

?錯誤提示:error:failed to push som refs to

?解決辦法:$ git pull origin master?//先把遠程服務器github上面的文件拉先來,再push 上去。

?

本人遇到的還有一個錯誤就是,工程傳進github 了可是里頭缺少文件,

解決方法 $git add . ? ?(注意一點 ?。 ?)表示添加所有文件,

?

?官方教程:

https://help.github.com/articles/create-a-repo

?

推薦教程:

找了幾篇關于github的教程,一步一步照葫蘆畫瓢 下面是兩個自我感覺不錯的教程,其他的都太墨跡了,食之無味:

使用github管理iOS分布式項目開發?http://www.cnblogs.com/516inc/archive/2012/03/28/2421492.html ? ? (比較詳細)

tit /github 使用方法小記: ? ?http://like-eagle.iteye.com/blog/1317009

轉載于:https://www.cnblogs.com/mengyan/archive/2013/01/10/2855530.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的github 使用总结-----转的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。