【发布时间】:2020-05-08 13:22:10
【问题描述】:
我在 Azure DevOps 上托管了一个使用 LFS 的存储库。
推送提交时,不会推送新的 LFS 对象(如果我将更改拉到单独的存储库中,它会产生 Smudge Error: Object does not exist on server [404])。
要推送 LFS 对象的唯一方法是通过指定对象 id 手动完成:
git lfs push origin --object-id ae488...
这是我的git config -l:
$ git config -l
http.sslcainfo=C:/Users/200207121/AppData/Local/Programs/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
core.autocrlf=true
core.fscache=true
core.symlinks=false
core.editor="C:\\Program Files\\Notepad++\\notepad++.exe" -multiInst -notabbar -nosession -noPlugin
credential.helper=manager
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.email=<omitted>
user.name=<omitted>
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
http.sslverify=false
diff.tool=default-difftool
difftool.default-difftool.cmd=code --wait --diff $LOCAL $REMOTE
merge.tool=vscode
mergetool.vscode.cmd=code --wait $MERGED
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://.../MyRepo/_git/MyRepo
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
lfs.https://dev.azure.com/.../MyRepo.git/info/lfs.access=basic
lfs.https://dev.azure.com/.../MyRepo/info/lfs/objects/.access=basic
branch.7_1_0.remote=origin
branch.7_1_0.merge=refs/heads/7_1_0
branch.7_1_A.remote=origin
branch.7_1_A.merge=refs/heads/7_1_A
branch.atvcm01008318_text_class.remote=origin
branch.atvcm01008318_text_class.merge=refs/heads/text_class
branch.atvcm01008824.remote=origin
branch.atvcm01008824.merge=refs/heads/atvcm01008824
branch.atvcm01000423.remote=origin
branch.atvcm01000423.merge=refs/heads/atvcm01000423
gui.wmstate=normal
gui.geometry=1272x626+-5+0 254 315
为了防止特定分支推送,我在pre-pushhook 中添加了这些行。我目前没有在这个分支上签出,我尝试推送的 LFS 也不在这个分支上(所以我不怀疑它可能是由这个钩子引起的):
#!/bin/sh
### Prevent pushing test branch
if [[ `grep 'testing_AA'` ]]; then
echo "You really don't want to push this branch. Aborting."
exit 1
fi
### End of edition
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"
为什么我必须为要推送的 LFS 指定 git lfs push --object-id <oid> ?
【问题讨论】:
-
您是否在存储库中运行了
git lfs install?你修改过任何钩子吗? -
是的,
git lfs install已运行。我已经修改了pre-push钩子以防止它推送特定的测试分支。我已经在我的问题中添加了它。 -
你使用的是什么 git lfs 版本,我在使用 2.92 之前的版本时遇到了几个问题
-
@bk2204 实际上回答了我的问题,不是因为 git lfs 的版本