我有一个带有2个lfs跟踪文件的repoA。我正把这个回购带到像这样的repoB
cd repoB
git fetch repoA somebranch
git checkout -b temp FETCH_HEAD
git rebase someotherbranch
打印几行“Apply:...”然后
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
Please, commit your changes or stash them before you can merge.
Aborting
error: Failed to merge in the changes.
Patch failed at 0340 update server
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
我该如何解决这个问题? 注意:此文件不存在于repoA 。这个问题似乎与git lfs的问题完全相关。
git status显示了这个
$ git status
rebase in progress; onto 5af1f30
You are currently rebasing branch 'gamepad' on '5af1f30'.
(all conflicts fixed: run "git rebase --continue")
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
deleted: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.sha256.bytes
no changes added to commit (use "git add" and/or "git commit -a")
注意:我尝试添加并提交2个文件(voodoo),然后git rebase --continue
继续运行,直到下次在历史记录中修改文件时,它会出现类似的错误。我做了同样的事情,终于完成了。但是当我试图将它改为另一个分支时,我得到了
Downloading Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (7.48 MB)
Error downloading object: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (4743b094eeab821140773213ebabdaa81c9ac2eb1be1108e70e8d51ae52873dd)
Errors logged to /Users/gregg/src/hft-unity3d/.git/lfs/objects/logs/20160603T213456.110362284.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge -- %f failed 2
error: external filter git-lfs smudge -- %f failed
fatal: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes: smudge filter lfs failed
Could not apply dc378b5d715103e9af0ee805ff2a3be1159739aa... add lfs support
哪种建议我不知道如何正确使用git lfs。
所以事实证明你必须在每个仓库中安装git lfs。 the docs表示
,这一点并不清楚您只需设置一次Git LFS。
git lfs install
事实证明,每次回购只有一次。
然后,通过the issues阅读它需要知道从哪里获取远程存储的文件。它基于正在跟踪的任何远程分支执行此操作,从
开始git clone git@github.com/me/repoA
cd repoA
git lfs install
git remote add repoB git@github.com/me/repoB
git fetch repoB
git checkout -b temp repoB/somebranch
这开始将repoB / somebranch签出到temp中但是
失败Downloading Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (7.48 MB)
Error downloading object: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes (f8c42a7c55f610768ce50ff93d09fc63fa897de867290dafee2e84d64e10de4e)
Errors logged to /Users/gregg/temp/delme-hft-unity3d/.git/lfs/objects/logs/20160603T231351.670335751.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge -- %f failed 2
error: external filter git-lfs smudge -- %f failed
fatal: Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes: smudge filter lfs failed
AFAIK我正在跟踪正确的分支。这是与文件上传的同一个遥控器上的相同分支。
从最后一个开始,但在克隆repoA之后将origin
更改为指向repoB进一步
git clone git@github.com/me/repoA
cd repoA
git lfs install
git remote remove origin
git remote add origin git@github.com/me/repoB
git fetch repoB
git checkout -b temp origin/somebranch
这适用于失败前的情况
但现在
git checkout -b other master
git branch --set-upstream-to origin/somebranch
git rebase master temp
在与之前相同的地方失败
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
Please, commit your changes or stash them before you can merge.
Aborting
error: Failed to merge in the changes.
Patch failed at 0358 update server
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
答案 0 :(得分:4)
好吧显然问题是当git调用hook时它没有传递当前的跟踪分支信息,所以lfs无法找到文件。它只是默认使用origin
的链接
为此,您需要使用--skip-smudge
选项安装lfs。这基本上会告诉lfs不要下载文件。按预期进行合并,然后git lfs pull
有一个远程参数,让你告诉它在哪里获取文件
一旦完成,我假设您可以键入git lfs install
以使其恢复正常。您可能需要执行git lfs fetch --all repoB
和git lfs push --all repoA somebranch
以将从先前repo的lfs存储(repoB)下载的所有文件获取到新repo的lfs存储(repoA)
# This disables smudging for the 'git clone'
# and then calls 'git lfs pull' for you
git lfs clone git@github.com:me/repoB.git
cd repoB
git lfs install --skip-smudge --local # affects only this clone
git fetch repoA
git checkout -b temp repoA/somebranch
git rebase master
git lfs fetch --all repoA
git lfs checkout
git push origin temp
git lfs push --all origin temp
git lfs install --force --local
git lfs pull
命令与调用git lfs fetch
(下载LFS对象)和git lfs checkout
(将本地下载的文件复制到工作目录)基本相同。因此,我的示例仅通过git lfs fetch --all
命令下载对象。
如果要为单个命令禁用涂抹过滤器,还可以使用GIT_LFS_SKIP_SMUDGE
:
$ GIT_LFS_SKIP_SMUDGE=1 git pull
$ git lfs pull
答案 1 :(得分:0)
Private Sub MaskedTextBox1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) _
Handles MaskedTextBox1.KeyDown
Me.validationToolTip.Hide(sender)
End Sub
的提交修改了文件repoA
。
同一个文件也在Assets/HappyFunTimes/HappyFunTimesCore/Server/Resources/HFTOSXServer.bytes
工作树中。 Git意识到它无法替换文件。要纠正它,你必须做git所建议的。 Git经常告诉你如何纠正错误。
存储或提交您的本地更改。在你的情况下,最好隐藏你的更改,进行rebase,弹出存储。这会给你以下命令。
repoB
在开始之前,请务必避免以前的rebase尝试。