-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file is outside repository in pre-commit git hook #955
Comments
Ah, it's clearly not getting the right directory when run as a hook. I'm not positive how git executes the command. |
Yeah, that's right. |
@dkoudela Ok, I found the problem while looking at an unrelated one. The way Git LFS handles You can get around this by changing your hook to override
Your hook is running with these two values:
Due to some confusing git documentation, Git LFS is treating the |
Thanks a lot! I am going to try the workaround. |
I can confirm, my pre-commit hook : https://github.com/dkoudela/lfs-tracking-hook/blob/master/pre-commit is working with the workaround. FYI, during my LFS testing, I found it is easy to miss some files and once they are committed they are never managed by the LFS. As I got a solution, I am closing the issue. |
Hi,
I am creating a pre-commit git hook for automatic lfs tracking of particular file types.
I have discovered following error:
JArchitectOut/2016_01/24_00_24/JArchitectAnalysisResult_Advanced_Ldap_for_Crucible_2016Jan24_00h22.jdar is outside repository
If I run the script manually, it works fine.
It looks like related to different lfs env (see below).
Is it possible to run '
git lfs track
' in the git hooks?Thanks,
David.
git hook:
git-lfs/1.1.0 (GitHub; linux amd64; go 1.5.1; git 258acf1)
git version 2.7.0
Endpoint=https://github.com/dkoudela/lfs-test.git/info/lfs (auth=none)
SSH=git@github.com:dkoudela/lfs-test.git
LocalWorkingDir=.
LocalGitDir=.git
LocalGitStorageDir=.git
LocalMediaDir=.git/lfs/objects
TempDir=.git/lfs/tmp
ConcurrentTransfers=3
BatchTransfer=true
GIT_DIR=.git
GIT_AUTHOR_DATE=@1453925380 -0800
GIT_INDEX_FILE=.git/index
GIT_WORK_TREE=.
GIT_AUTHOR_NAME=David Koudela
GIT_PREFIX=
GIT_AUTHOR_EMAIL=...
git config filter.lfs.smudge = "git-lfs smudge %f"
git config filter.lfs.clean = "git-lfs clean %f"
terminal:
git-lfs/1.1.0 (GitHub; linux amd64; go 1.5.1; git 258acf1)
git version 2.7.0
Endpoint=https://github.com/dkoudela/lfs-test.git/info/lfs (auth=none)
SSH=git@github.com:dkoudela/lfs-test.git
LocalWorkingDir=/opt/gitrepos/lfs-test
LocalGitDir=/opt/gitrepos/lfs-test/.git
LocalGitStorageDir=/opt/gitrepos/lfs-test/.git
LocalMediaDir=/opt/gitrepos/lfs-test/.git/lfs/objects
TempDir=/opt/gitrepos/lfs-test/.git/lfs/tmp
ConcurrentTransfers=3
BatchTransfer=true
git config filter.lfs.smudge = "git-lfs smudge %f"
git config filter.lfs.clean = "git-lfs clean %f"
The text was updated successfully, but these errors were encountered: