git fatal: refusing to merge unrelated histories

今天在拉取远程仓库上的项目时出现了这个个问题

C:\Users\Administrator\Source\Repos\NewRepo>git pull https://github.com/houchuanhao/ACM.git master
From https://github.com/houchuanhao/ACM

错误提示如下

 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

原因是在本地的文件夹为NewRepo,与远程仓库名称不一样

解决方案:

pull时添加 –allow-unrelated-histories

C:\Users\Administrator\Source\Repos\NewRepo>git pull origin master --allow-unrelated-histories
From github.com:houchuanhao/ACM
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 README.md | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 README.md

你可能感兴趣的:(github)