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.

  • Compress JS/CSS files on deploy using Git
  • git doesn't auto commit when I pull
  • Removing/undoing a merge on Sourcetree
  • Get a list of all tags between two commits
  • How can I sort a set of git commit IDs in topological order?
  • Obtain a git repository's tree elsewhere via --work-tree while keeping --git-dir repository unmodified
  • Linux ——————————————————–winGitBash

    enter image description here

  • Git Clone : Permission denied (publickey). fatal: Could not read from remote repository
  • How to setup a remote for git that it's in my c disk (win vista)?
  • Difference between Git and Nexus?
  • What's the best way import only a few branches' history when switching from SVN to Git?
  • Git blame on a renamed file that is not yet committed
  • R: Git + Shiny server automated deployment
  • 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:

    • core.eol
    • core.autocrlf
    • .gitattributes file

    For you situation, I suspect below may be the reason.

    • In your git “database”(.git), all text files are stored with newline LF.
    • Your local repo is cloned under Windows, during checkouting git converts
      LF into CRLF.
    • When you do git status under 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 CRLF
      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
    

    And run git status again, you will/should see the output reports no modification.

    References:

    Mind the end of your line

    Git Baby is a git and github fan, let's start git clone.