Being new to Git I got thrown off a few weeks ago when cloning a remote repository and immediately seeing changes after the clone completed.  Scratching my head a bit, I reached out on Twitter and James Gregory came to the rescue.

How is it that right after a git clone <url>, git status shows modified files? (http://twitter.com/TimBarcz/status/5920294511)

What James showed me was that there is a setting core.autocrlf on your system which needs to match the remote repository.  If it does not match, when you clone the directory files will be changed.

After experiencing this myself and coming across it again the other day, I thought I’d put a quick video together showing the problem and the fix, since I suspect others will have it at some point as well.

To recap: when cloning a new repository, always perform a “git status” command right after the clone.  If you see modified files, a core.autocrlf mismatch is likely the culprit.  Change your setting, clone again, and you should be good to go.


 
Categories: