0
我是新來的Git的& GitHub上,無法倉庫裏的文件推送到遠程存儲庫(GitHub上)
我有一個名爲HackerRank 我有一個遠程倉庫https://github.com/xxx/HackerRank.git
現在我想推動本地存儲庫我本地存儲庫到遠程存儲庫。
我用下面的命令
git remote add hacker https://github.com/xxx/HackerRank.git
git push hacker master
它扔錯誤
To https://github.com/xxx/HackerRank.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxx/HackerRank.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
所以現在我想從我的遠程倉庫拉使用以下命令
git pull hacker master
From https://github.com/xxx/HackerRank
* branch master -> FETCH_HEAD
* [new branch] master -> hacker/master
fatal: refusing to merge unrelated histories
現在我試圖使用以下命令獲取
$ git fetch hacker
From https://github.com/xxx/HackerRank
* [new branch] master -> hacker/master
現在,我嘗試使用以下命令
$ git merge hacker/master
fatal: refusing to merge unrelated histories
請給我建議合併。
'拒絕合併無關histories'合併 - 你可以」只需將隨機內容推送到現有的分支。 –
從你的錯誤日誌,你必須拉/取rebo之前推入它! '在再次推送前整合遠程更改(例如'git pull ...')。' – hassan
@OliverCharlesworth我在GitHub中單獨創建了一個名爲HackerRank的倉庫,以及我的本地倉庫名稱也是HackerRank,所以我希望它們應該是同一個倉庫 – Renigunda