我在centos 7中将git-lfs 2.4.2
与git 1.8.3.1
一起使用。
git config如下:
[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
。如何解决?