git status shows as files modified directly after clones


アトラシアン コミュニティをご利用ください。


プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。


git status shows some of the files as modified after the clone without making any local changes. Following appears when a git status is run

[user@myhost ~]$ git clone -b release/3.10.2 ssh://
Cloning into 'repo'...
remote: Counting objects: 351985, done.
remote: Compressing objects: 100% (133993/133993), done.
remote: Total 351985 (delta 176642), reused 341876 (delta 168250)
Receiving objects: 100% (351985/351985), 293.39 MiB | 4.41 MiB/s, done.
Resolving deltas: 100% (176642/176642), done.
Checking connectivity... done.
[user@myhost ~]$ cd repo
[user@myhost ~]$ git status
On branch release/3.10.2
Your branch is up-to-date with 'origin/release/3.10.2'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: my-backend/configuration/config/dev1/properties-key.xml
modified: my-backend/configuration/config/dev2/properties-key.xml
modified: my-backend/configuration/config/local/properties-key.xml

no changes added to commit (use "git add" and/or "git commit -a")


  1. The behavior which showing some files as modified could be related to line ending setting and multiple client used. Every operating system handles line endings in it's own way. So if you are working on repositry where in the the files are edited in multiple operating systems, you may see unexpected results.
  2. .gitattributes file added to the root of the repo. It will override individual client settings and may trigger a line ending change after the clone.


原因 1 の対応

You can change how Git handles line endings by git config core.autocrlf command is used to change. It takes a single argument.

git config --global core.autocrlf input
# Configure Git on <your os> to properly handle line endings

原因 2 の対応

Verify your if there any .gitattributes file that trigger line ending changes. It overrides an client's core.autocrlf setting, to ensure a consistent behavior for all users, regardless of their Git settings. 

You can find more details about .gitattributes here.

最終更新日 2018 年 1 月 24 日


Powered by Confluence and Scroll Viewport.