Can anyone explaine why “git status” shows files as modfied when running under a share on linux?
The files are hosted on a windows machine,, and i was wondering if i cold use my Linux box to manage git, so i mounted the share. And then i see that when doing git status all the files shows as modified, and when trying to push from this share it wont accept my key.
The image is from same snapshot, same folder at same time.
3 Solutions collect form web for “Can anyone explaine why “git status” shows files as modfied when running under a share on linux?”
This blog post explains it quite nicely. Basically it is good idea to set:
git config –global core.autocrlf true
Have you checked your
crlf settings on the two machines? One may be re-creating the files as CRLF (Windows) while the other has just LF endings. That would be sufficient for the ‘modified’ status.
Don’t forget your personal settings as well as the repo settings.
How git behaves on newline depends on several configurations:
- .gitattributes file
For you situation, I suspect below may be the reason.
- In your git “database”(.git), all text files are stored with newline
- Your local repo is cloned under Windows, during checkouting git converts
- When you do
git statusunder Linux/cygwin, since the “cygwin git” thinks it is working
under “*inux” environemnt, so that that git thinks the local repo are supposed to
checkout text files with
LF. When it actually finds
CRLF, it thinks that
is changed from
LF, so git reports they are modified.
To verify this(not fix this), you can do:
# under linux # save your change git stash # delete working directory git rm --cached -r . # re-checkout git reset --hard
git status again, you will/should see the output reports no modification.
Mind the end of your line