[note]如何拿別人的 github wiki 來改 並放到自己的 repo - Azraeil/JCcart_Note GitHub Wiki
git clone https://github.com/NickWarm/jccart.wiki.git
自己要先開個 repo (不確定)然後去 wiki 頁面開一個分頁 然後改 remote origin config
vim .git/config
改成你的 repo:
[remote "origin"]
url = https://github.com/Azraeil/JCcart_Note.wiki.git
(選擇)接着修改你clone下來的 接着 commit 然後要先 git pull 把你本來在 github 上的 wiki 拉下來合併 不然會不給 push:
$ git push -u origin master
To https://github.com/Azraeil/JCcart_Note.wiki.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Azraeil/JCcart_Note.wiki.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 pull origin master --allow-unrelated-histories
從 git 2.9.0 開始預設行為不允許合併沒有共同祖先的分支。
你需要加上 --allow-unrelated-histories 選項才不會出現這個錯誤訊息。
參考:https://github.com/doggy8088/Learn-Git-in-30-days/issues/31
觀察 status。
處理 conflict。
處理完後 commit。
最後:
git push -u origin master
Done.