git fatal: refusing to merge unrelated histories

来源:互联网 发布:猪八戒的前世今生 知乎 编辑:程序博客网 时间:2024/05/29 15:45

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

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

错误提示如下

 * branch            master     -> FETCH_HEADfatal: refusing to merge unrelated histories

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

解决方案:

pull时添加 –allow-unrelated-histories

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