问题描述
我正在尝试从Github(git pull origin master
)将代码提取到我们的服务器上.
I'm attempting to pull code onto our server from 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
我在GIT_TRACE=1
上运行了相同的命令:
I ran the same command with 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
我已验证我的ssh凭据正确:
I verified my ssh credentials are correct:
$ ssh -T [email protected]
Hi user-name! You've successfully authenticated, but GitHub does not provide shell access.
而且,事实上,我知道凭据是可以的,因为pull
会降低.gitattributes
文件(以及我所做的其他小文件更改):
And, in fact, I know the credentials are ok, because the pull
will bring down the .gitattributes
file (along with other small file changes I've done):
file.msi filter=lfs diff=lfs merge=lfs -text
我验证了Git LFS似乎配置正确:
I verified Git LFS appears to be configured correctly:
$ 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
...
我发现了这个 Github问题,我尝试了所有三个步骤:
I found this Github issue, and I tried all three steps:
$ 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
第一步要求输入我的用户名.因此,正如它所说的,似乎Git LFS似乎没有缓存任何东西.
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.
我最近采取的两项操作可能破坏了某些内容:
There are two actions I took recently that might have broken something:
- 我从存储库中删除了一个用户.服务器的ssh密钥属于用户.我们添加了一个部署密钥,但是我读到 Git LFS没有支持部署密钥(尽管最近似乎添加了支持).因此,我们切换到了用户密钥.两个键均通过
ssh -T [email protected]
测试确认.仍然可能存在身份验证问题? - 我将存储库下拉到没有Git LFS的服务器上.当时我没有意识到,但是传输到目标服务器的文件很好.但是,这可能会破坏存储库中的某些内容?
- 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? - 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?
任何可以借给您的帮助将不胜感激.
Any help you could lend would be greatly appreciated.
PS-很抱歉,我的匿名处理造成混乱.我用X.X.X.X
替换了我们的实际IP地址;我们的组织名称为org-name
;我们的回购名称以repo-name
表示;我们的Github用户使用user-name
; file.msi
的文件名;还有更多的东西.
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.
编辑5/16/17:添加了语言以明确表明它曾经可以正常工作……而我将其弄坏了.
EDIT 5/16/17: Added language to make it clear that it used to work... and that I broke it.
推荐答案
在我的情况下,已对SSH身份验证的存储库进行了更新,以使用来自其他客户端的LFS,而在我这一方面,Git-LFS不知道SSH远程URL .我要修复的问题如下:
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:
将在remote.origin.url
中配置的URL(origin
的推送URL)复制到lfs.url
(LFS使用的URL):
Copy the URL configured in remote.origin.url
(push URL for origin
) to lfs.url
(the URL LFS uses):
$ git config lfs.url $(git config remote.origin.url)
(如果您的遥控器未命名为origin
,请更改为您的遥控器名称.)
(If your remote is not named origin
then change to your remote name.)
然后运行
$ git config lfs.url
显示URL并确认它确实包含SSH URL,而不包含某些HTTP/HTTPS URL.
to show the URL and confirm that it does indeed contain an SSH url, and not some HTTP/HTTPS url.
那么你可以
$ git pull
完成.
如果您之前搞砸了,而master
和orgin/master
像我一样在某种程度上有所分歧,那么您可能需要git checkout -fB master origin/master
(这不要求,并且会覆盖master分支的本地版本,因此请注意并仔细执行!).
If you screwed up before and master
and orgin/master
have 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!).
另请参阅: https://github.com/git -lfs/git-lfs/issues/2661#issuecomment-335903332
这篇关于git pull-污迹过滤器lfs失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!