首页 > 解决方案 > 如何让 `git lfs` 识别 `core.filemode=false`?

问题描述

我在 centos 7 中使用git-lfs 2.4.2with。git git 1.8.3.1config 如下:

[root@localhost www]# git config --list
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
core.safecrlf=true
core.filemode=false
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
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.safecrlf=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

通过How to write post-checkout hook to chmod 666 to all files? ,我将post-checkout钩子设置如下:

##!/bin/bash
## post-chekcout script

set -e

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/post-checkout.\n"; exit 2; }
git lfs post-checkout "$@"

exec chmod -R a+rwX .

之后git checkout -b develop,很多.jpg, .gif(由 git-lfs 跟踪的文件)修改 mod 如下:

# On branch develop
# Changes not staged for commit:
#   modified:   admin/images/admin_tit_bg.jpg
#   modified:   user/images/ajax_loader.gif

之后,我运行git commit -am,然后git checkout master,得到以下错误:

Pointer file error: Unable to parse pointer at: "admin/images/admin_tit_bg.jpg"
Pointer file error: Unable to parse pointer at: "user/images/ajax_loader.gif"
Checking out files: 100% (321/321), done.
Switched to branch 'master'

好像git-lfs不认识core.filemode=false。怎么解决?

标签: gitgit-lfs

解决方案


推荐阅读