如何在github創建新的倉庫項目

    學習機器學習,看着《機器學習實戰》,從其官網下載了源代碼,可能是因爲懶吧,不想盯着書本敲着裏面的代碼,下了之後想到以後修改啥的,就想放在github上託管吧,之前都是fork別人的倉庫,沒有親自創建過,那就創一個吧。

    在your profile的Repositories,點擊創建,如下圖:

    然後會出現下圖:

把對應的填寫完,再勾上initialize this repository with a README,後面你就不用再添加了。

接下來如下圖:

這樣你就創建好了一個倉庫,接下來的事情是你怎麼把本地的git倉庫和這個倉庫相連接,在本地git倉庫下打開git bash,執行:

git remote add origin [email protected]:lvwuyunlifan/test.git    # 這是綁定本地和github上的遠程倉庫

如果出現錯誤提醒:

fatal: remote origin already exists.

則先執行:git remote rm origin,再執行:

git remote add origin [email protected]:lvwuyunlifan/test.git

剛開始倉庫什麼都沒有,執行:

git push -u origin master

如果出現錯誤提示:hint: See the 'Note about fast-forwards' in 'git push --help' for details.說明本地倉庫和遠程倉庫版本不一致,則先:

git pull 倉庫地址

如果報錯:fatal: refusing to merge unrelated histories

那說明有衝突,則執行:

git pull origin master --allow-unrelated-histories

git status  # 找出紅色標註的進行解決衝突,解決完了之後:

git add .

git commit -m 'some thing'

git push origin master

進行遠程推送。至此已完成。

歡迎star我的《機器學習實戰》倉庫

地址:[email protected]:lvwuyunlifan/Mechine-Learn-in-Action.git

[email protected]:lvwuyunlifan/Mechine-Learn-in-Action.git
[email protected]:lvwuyunlifan/Mechine-Learn-in-Action.git

書本的作者是有源代碼的項目,只是我沒看到,創建了倉庫之後才發現的,

地址:[email protected]:pbharrin/machinelearninginaction.git

[email protected]:lvwuyunlifan/test.git
[email protected]:lvwuyunlifan/test.git

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章