2017-08-24 41 views
1

這與發佈的問題並不相似,因爲我已經完成了我的研究。git刪除回購後的致命錯誤

我想拉GitHub上創建一個新的回購,並得到該錯誤消息:

$ git pull https://github.com/{my repo}.git 
From https://github.com/{my repo} 
* branch   HEAD  -> FETCH_HEAD 
fatal: refusing to merge unrelated histories 

我已經試過這樣:

$ git merge origin/master --allow-unrelated-histories 
merge: origin/master - not something we can merge 

也這樣:

$ git pull --allow-unrelated-histories origin master 
remote: Repository not found. 
fatal: repository 'https://github.com/{my user name}/20170802.git/' not found 

和這個:

$ git fetch 
remote: Repository not found. 
fatal: repository 'https://github.com/{my uer name}/20170802.git/' not found 

這種情況發生在我刪除了不讓我推送電影文件(大於50mb)的回購之後。當github不允許我上傳文件時:我重置了舞臺,並刪除了電影文件,並在我的計算機上的項目文件夾中粘貼了一個新文件,並嘗試再次推送,但gitbash一直顯示我正在嘗試推送舊電影文件。 我正在使用gitbash for windows 10.

+0

你想克隆或拉?您似乎也錯過了第一個代碼段中的URL中的用戶名。 – TW80000

回答

2

如何使用git clone命令? 像這樣:

$ git clone https://github.com/{my repo}.git 

command將創建遠程git倉庫的本地副本在目錄中的git bash的指定是目前。

你提到拉一個「新回購」,你說你之前已經「刪除回購」,因爲你在推送某些內容時遇到了麻煩。因此,這個庫可能需要再次克隆到本地目錄。這就是爲什麼錯誤告訴你沒有找到存儲庫的原因,因爲它不再存在於你的本地環境中。

如果你試圖把倉庫到您的計算機的第一次(或者,如果它不是目前存在了),那麼你就必須使用Git的clone命令。

克隆它後,您的存儲庫分支已經與原來的最新提交保持一致。

之後,當原產地/ {branch_name}發生更改時,您可以使用git fetchgit pull讓您的本地分支保持最新狀態。

+1

謝謝TW80000和0xDEFACED清除這個。由於我得到的錯誤,我很失控,並且讓一個菜鳥的錯誤混淆了兩個名稱相似的項目,一個是工作,一個是個人。 – Viet

+0

沒有問題!樂意效勞 :) – 0xDEFACED