Git untracked/unstaged files right after clone

纵然是瞬间 提交于 2021-02-08 08:10:26

问题


I make clone of a git repository, and right after it I get untracked and unstaged (modified/deleted) files in git status. Then I set fileMode=false for Mac, and several files go away from unstaged. But I cannot understand what to do with the others. I've tried a bunch of things from stackoverflow and other places, but nothing helps.

So my question is why I get all these untracked / unstaged files right after cloning the repo, and how to fix it. I use Mac for development, but I've tried to clone repo in Windows to see if it's the same or not. It's even funnier: it says some unstaged files deleted.

After different modifications of git config, the command git config -l looks like this:

Mac:

filter.lfs.clean=git-lfs clean %f
filter.lfs.smudge=git-lfs smudge %f
filter.lfs.required=true
user.email=...hidden...
user.name=...hidden...
core.autocrlf=true
core.precomposeunicode=true
core.filemode=false
core.trustctime=false
alias.gr=log --graph --full-history --all --color --decorate
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.url=https://bitbucket.org/...hidden...
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.demo.remote=origin
branch.demo.merge=refs/heads/demo

Win:

core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://bitbucket.org/...hidden...
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.demo.remote=origin
branch.demo.merge=refs/heads/demo

My git status looks like this:

Mac:

Win:

How can it be solved?


回答1:


OK, after some time of working on the problem I've found 2 solutions in this post (which is also mentioned by Christoph), it was filemode=false and lowercase twins. But untracked files remained. Then I understood that these untracked files have UTF8 characters in their filenames, and somewhere these characters were misunderstood by filesystem and/or git. I looked at these files and found that they are not actual anymore, so I just deleted them and commited this deletion.



来源:https://stackoverflow.com/questions/38919106/git-untracked-unstaged-files-right-after-clone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!