Git pull - 涂抹过滤器 lfs 失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43989902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:45:47  来源:igfitidea点击:

Git pull - smudge filter lfs failed

gitgithubgit-lfs

提问by Hyman

I'm attempting to pull code onto our server from Github (git pull origin master).

我正在尝试将代码从 Github ( git pull origin master)拉到我们的服务器上。

This worked before. However, now, I'm receiving the following error:

这以前有效。但是,现在,我收到以下错误:

$ git pull origin master
From github.com:org-name/repo-name
 * branch              master     -> FETCH_HEAD
Updating 8024663e..e458e5c1
fatal: path/to/file.msi: smudge filter lfs failed

I ran the same command with GIT_TRACE=1:

我运行了相同的命令GIT_TRACE=1

$ GIT_TRACE=1 git pull origin master
19:25:26.331064 git.c:371               trace: built-in: git 'pull' 'origin' 'master'
19:25:26.333947 run-command.c:350       trace: run_command: 'fetch' '--update-head-ok' 'origin' 'master'
19:25:26.334661 exec_cmd.c:116          trace: exec: 'git' 'fetch' '--update-head-ok' 'origin' 'master'
19:25:26.337625 git.c:371               trace: built-in: git 'fetch' '--update-head-ok' 'origin' 'master'
19:25:26.344457 run-command.c:350       trace: run_command: 'ssh' '[email protected]' 'git-upload-pack '\''org-name/repo-name.git'\'''
19:25:26.925565 run-command.c:350       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
19:25:26.937016 run-command.c:350       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
19:25:26.937833 exec_cmd.c:116          trace: exec: 'git' 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
19:25:26.941292 git.c:371               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
From github.com:org-name/repo-name
 * branch              master     -> FETCH_HEAD
19:25:26.994717 run-command.c:1130      run_processes_parallel: preparing to run up to 1 tasks
19:25:26.994880 run-command.c:1162      run_processes_parallel: done
19:25:26.995780 run-command.c:350       trace: run_command: 'gc' '--auto'
19:25:26.996735 exec_cmd.c:116          trace: exec: 'git' 'gc' '--auto'
19:25:27.000596 git.c:371               trace: built-in: git 'gc' '--auto'
19:25:27.002716 run-command.c:350       trace: run_command: 'merge' 'FETCH_HEAD'
19:25:27.003445 exec_cmd.c:116          trace: exec: 'git' 'merge' 'FETCH_HEAD'
19:25:27.006078 git.c:371               trace: built-in: git 'merge' 'FETCH_HEAD'
Updating 8024663e..e458e5c1
19:25:27.420945 run-command.c:350       trace: run_command: 'git-lfs filter-process'
19:25:27.470865 run-command.c:209       trace: exec: '/bin/sh' '-c' 'git-lfs filter-process' 'git-lfs filter-process'
trace git-lfs: run_command: 'git' version
trace git-lfs: run_command: 'git' config -l
trace git-lfs: Initialize filter-process
trace git-lfs: Read filter-process request.
trace git-lfs: Read filter-process request.
fatal: path/to/file.msi: smudge filter lfs failed
19:25:27.998635 run-command.c:42        trace: run_command: running exit handler for pid 18022

I verified my ssh credentials are correct:

我验证了我的 ssh 凭据是正确的:

$ ssh -T [email protected]
Hi user-name! You've successfully authenticated, but GitHub does not provide shell access.

And, in fact, I know the credentials are ok, because the pullwill bring down the .gitattributesfile (along with other small file changes I've done):

而且,事实上,我知道凭据没问题,因为这pull会关闭.gitattributes文件(以及我所做的其他小文件更改):

 file.msi filter=lfs diff=lfs merge=lfs -text

I verified Git LFS appears to be configured correctly:

我验证了 Git LFS 似乎配置正确:

$ git config -l
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
...

I found this Github issue, and I tried all three steps:

我发现了这个Github 问题,我尝试了所有三个步骤:

$ echo "protocol=https\nhost=github.com" | git credential fill
$ echo "protocol=https\nhost=github.com" | git credential fill | git credential reject
$ echo "protocol=https\nhost=github.com" | git credential fill | git credential approve

The first step asked for my username. So, as it says, it doesn't appear that Git LFS is caching anything.

第一步询问我的用户名。所以,正如它所说,Git LFS 似乎没有缓存任何东西。

I don't have much experience with Git LFS, and frankly, I am out of ideas on how to approach this problem.

我对 Git LFS 没有太多经验,坦率地说,我对如何解决这个问题一无所知。

There are two actions I took recently that might have broken something:

我最近采取的两个行动可能会破坏某些东西:

  1. I removed a user from our repository. The server's ssh key belonged to the user. We added a deployment key, but I read that Git LFS didn't support deployment keys(although, it appears that support was added recently). So, we switched to a user key. Both keys were confirmed with the ssh -T [email protected]test. Still, perhaps there's an authentication issue?
  2. I pulled the repository down onto a server without Git LFS. I didn't realize it at the time, but the files transferred to the destination server fine. However, perhaps this broke something in the repository?
  1. 我从我们的存储库中删除了一个用户。服务器的 ssh 密钥属于用户。我们添加了一个部署密钥,但我读到Git LFS 不支持部署密钥(尽管最近似乎添加了支持)。因此,我们切换到用户密钥。通过ssh -T [email protected]测试确认了两个键。不过,也许存在身份验证问题?
  2. 我将存储库拉到没有 Git LFS 的服务器上。我当时没有意识到,但文件传输到目标服务器很好。但是,也许这破坏了存储库中的某些内容?

Any help you could lend would be greatly appreciated.

您可以提供的任何帮助将不胜感激。

PS - I'm sorry if my anonymizing creates confusion. I replaced our actual IP address with X.X.X.X; our organization name with org-name; our repo name with repo-name; our Github user with user-name; the file name with file.msi; and, a few more things.

PS - 如果我的匿名化造成混乱,我很抱歉。我用X.X.X.X;替换了我们的实际 IP 地址;我们的组织名称带有org-name; 我们的回购名称为repo-name; 我们的 Github 用户user-name:带有file.msi;的文件名 还有一些事情。

EDIT 5/16/17: Added language to make it clear that it used to work... and that I broke it.

2017 年 5 月 16 日编辑:添加了语言以表明它曾经可以工作......而且我破坏了它。

采纳答案by grandchild

In my case the SSH-authenticated repository was updated to use LFS from another client and on my side Git-LFS didn't know about the SSH remote-url. What I did to fix it was the following:

就我而言,经过 SSH 验证的存储库已更新为使用来自另一个客户端的 LFS,而在我这边,Git-LFS 不知道 SSH 远程 URL。我为修复它所做的如下:

Copy the URL configured in remote.origin.url(push URL for origin) to lfs.url(the URL LFS uses):

remote.origin.url(push URL for origin)中配置的 URL 复制到lfs.url(LFS 使用的 URL):

$ git config lfs.url $(git config remote.origin.url)

(If your remote is not named originthen change to your remote name.)

(如果您的遥控器未命名,origin则更改为您的遥控器名称。)

Then run

然后运行

$ git config lfs.url

to show the URL and confirm that it does indeed contain an SSH url, and not some HTTP/HTTPS url.

显示 URL 并确认它确实包含一个 SSH url,而不是一些 HTTP/HTTPS url。

Then you can

然后你可以

$ git pull

Done.

完毕。



Ifyou screwed up before and masterand orgin/masterhave somehow diverged as was the case for me then you might need to git checkout -fB master origin/master(this doesn't ask and overwrites the local version of the master branch, so beware and execute carefully!).

如果你之前和搞砸了master,并orgin/master在一定程度上将分歧的是对我的情况,那么你可能需要git checkout -fB master origin/master(这不问和覆盖主分支的本地版本,所以要小心并认真执行!)。

See also: https://github.com/git-lfs/git-lfs/issues/2661#issuecomment-335903332

另见:https: //github.com/git-lfs/git-lfs/issues/2661#issuecomment-335903332