0

And more importantly, how can this be prevented?

echo tracked > tracked.txt
git add tracked.txt
git commit tracked.txt -m "tracked"
echo untracked > untracked.txt
ls -l  

total 2
-r--r--r-- 1 My Name 1049089 8 Dec 2 09:17 tracked.txt
-rw-r--r-- 1 My Name 1049089 10 Dec 2 09:18 untracked.txt

git checkout master -- tracked.txt
ls -l

total 2
-r--r--r-- 1 My Name 1049089 8 Dec 2 09:17 tracked.txt
-r--r--r-- 1 My Name 1049089 10 Dec 2 09:18 untracked.txt

config
    [core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true

.gitattributes
    * filter=lfs diff=lfs merge=lfs -text lockable
    .gitattributes -filter -diff -merge -text
    .gitattributes export-ignore
    README.md export-ignore
gitrdone
  • 21
  • 1
  • 5
  • I can't make that happen, something else about your setup is doing that to you. – jthill Dec 02 '21 at 15:31
  • do you have something else that could act on your files ? could be git related, like hooks or filters, or not git related, like a job which triggers when the content of your directory changes or some external software like Dropbox / Onedrive ... – LeGEC Dec 02 '21 at 16:19
  • No hooks or filters other than LFS. I have posted the core config options and the .gitattributes. Perhaps there is something there I don't understand. – gitrdone Dec 02 '21 at 17:14
  • What is the current `umask` ? – phd Dec 02 '21 at 17:37
  • 1
    umask is 0022 or u=rwx,g=rx,o=rx – gitrdone Dec 02 '21 at 17:59
  • 1
    Then it's `post-checkout` hook. If it's not in `.git/hooks/` lookup your global `git config core.hooksPath` – phd Dec 02 '21 at 18:47
  • 1
    *Git* doesn't do this. You have some sort of add-on software that's doing it. Find that and squash it. (If you're not using hooks—check your system and user config files for any global hooks—then it might be some sort of broken virus-scanner or something.) – torek Dec 02 '21 at 18:59
  • Sure enough phd had the right idea. The description of the LFS post-checkout hook is "Responds to Git post-checkout events. It makes sure that any files which are marked as lockable by git lfs track are read-only in the working copy, if not currently locked by the local user." I guess my question is why is git lfs tracking files that have not been added to git. – gitrdone Dec 02 '21 at 19:17
  • 1
    The git LFS support team have entered this as a bug. – gitrdone Dec 02 '21 at 22:14

0 Answers0