git lfs迁移后,pull时出现“拒绝合并不相关的历史记录”

问题描述 投票:0回答:1

我将 git LFS 应用到我的存储库。我使用的命令是: (此存储库中没有分支。)

git lfs migrate import --include="*.uasset"
git push --force origin master

没有错误。

但是今天,另一位告诉我,当他尝试从我应用了 git lfs 的存储库中拉取时,出现了以下错误: (他也没有分行。)

fatal: refusing to merge unrelated histories

我用谷歌搜索,在很多情况下,解决方案是执行下面的命令:

git pull origin master --allow-unrelated-histories

git push --force origin master

当我应用 git lfs 时,我已经将新的本地历史记录强制推送到远程,所以我认为第一个答案(=允许不相关的历史记录)就是我必须告诉他的。

我的理解对吗?

谢谢你。

git git-lfs
1个回答
0
投票

我上面问的两个命令都不起作用。

但是下面的命令解决了问题:

git lfs 安装 git reset --hard origin/master

我将本地存储库迁移到 LFS 并将新历史记录推送到远程。因此,使用存储库的另一个人必须做的就是安装 lfs(它向 git pull 命令添加钩子)并将其本地历史记录重置为 origin 的。

© www.soinside.com 2019 - 2024. All rights reserved.