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.

  • Storing generated files in Git
  • solution for GIT GUI client for remote SSH
  • Entity Framework 6.1.3 and SQL Server CE 4.0 - No Entity Framework provider found
  • Git push master fatal: You are not currently on a branch
  • Git pushes to wrong heroku app
  • move my global .gitconfig file
  • Linux ——————————————————–winGitBash

    enter image description here

  • Add Github fork to existing repository
  • Does picking a range of commits with cherry-pick or rebase --onto end up with the same result?
  • How do I create a readable diff of two spreadsheets using git diff?
  • Rewrite git history replacing a word in every single file
  • Git selectively ignoring despite gitignore file
  • GitHub keeps saying “This branch is X commits ahead, Y commits behind”
  • 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.


    Mind the end of your line

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