You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hmm, it actually looks like it doesn't have permissions to write to the .git/lfs/ directory. I think there are a couple things going on here.
First, we can definitely handle this particular error better and put out a more helpful message about file permissions.
Second, when git lfs track is run in a directory without a .git/ directory it will add the .gitattributes file no matter what. In a sense we want to be able to do that because a .gitattributes file can be in any folder in the repo, however, if we fail to calculate the LocalGitDir we should probably give the suggested error. There might be some other commands that should check this, too (git lfs env comes to mind, that will just print blank information if you're not in a repo).
I am curious, though, how your .git/lfs folder got to be in a non-writeable state. Do you recall the steps you took before this error occurred? What are the permissions on the .git/lfs directory (e.g. ls -la .git)?
The permission of my $HOME/.git is 755, so I have no idea what's the reason why it can't write into it, this is the first point.
Another point is, $HOME/.git is not a repo directory, I put some git contrib files for personally use there, seems git-lfs only use filename to detect a git repo, this behavior may be not correct, right?
Ths last thing is that I fount that if I remove .git under my home directory, then $ git lfs track "*.sj" can work anywhere(inside my home), is this behavior correct? I meant work without a git repo?
Ths last thing is that I fount that if I remove .git under my home directory, then $ git lfs track "*.sj" can work anywhere(inside my home), is this behavior correct? I meant work without a git repo?
Yeah, I think this part is incorrect. That's what I was getting at in my second part, but in too many words 😄 We should definitely give a message that you're not in a repo when running that.
Activity
tclem commentedon Apr 9, 2015
Yup! Good catch and your suggestion sounds sensible.
rubyist commentedon Apr 9, 2015
Hmm, it actually looks like it doesn't have permissions to write to the
.git/lfs/directory. I think there are a couple things going on here.First, we can definitely handle this particular error better and put out a more helpful message about file permissions.
Second, when
git lfs trackis run in a directory without a.git/directory it will add the.gitattributesfile no matter what. In a sense we want to be able to do that because a.gitattributesfile can be in any folder in the repo, however, if we fail to calculate theLocalGitDirwe should probably give the suggested error. There might be some other commands that should check this, too (git lfs envcomes to mind, that will just print blank information if you're not in a repo).I am curious, though, how your
.git/lfsfolder got to be in a non-writeable state. Do you recall the steps you took before this error occurred? What are the permissions on the.git/lfsdirectory (e.g.ls -la .git)?PeterDaveHello commentedon Apr 9, 2015
Hi @rubyist,
The permission of my
$HOME/.gitis 755, so I have no idea what's the reason why it can't write into it, this is the first point.Another point is,
$HOME/.gitis not a repo directory, I put some git contrib files for personally use there, seems git-lfs only use filename to detect a git repo, this behavior may be not correct, right?Ths last thing is that I fount that if I remove
.gitunder my home directory, then$ git lfs track "*.sj"can work anywhere(inside my home), is this behavior correct? I meant work without a git repo?Thanks a lot!
rubyist commentedon Apr 9, 2015
Yeah, I think this part is incorrect. That's what I was getting at in my second part, but in too many words 😄 We should definitely give a message that you're not in a repo when running that.
PeterDaveHello commentedon Apr 9, 2015
👍 agree, that's what I hope, sorry that I didn't write in golang, so I can just open issue instead of sending PR, thanks for your contribution 😄
rubyist commentedon Apr 9, 2015
No worries at all, the feedback you've been giving has been great, we really appreciate it!
technoweenie commentedon May 22, 2015
Fixed in #323
PeterDaveHello commentedon May 23, 2015
👍