今天在拉取远程仓库上的项目时出现了这个个问题
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
本文介绍了在使用Git从远程仓库拉取代码时遇到的“refusing to merge unrelated histories”错误及其解决方案。通过添加特定参数,可以成功地将远程仓库的内容合并到本地不同名的文件夹中。
7722

被折叠的 条评论
为什么被折叠?



