豚吐露@wiki
修正してないfileに差分がある
最終更新:
ohden
-
view
修正してないfileに差分がある
Ubuntu 18.04.1 LTS on WSL
git version 2.17.1
git version 2.17.1
修正してないのにfileに差分があるって言われる
git status
$ git st src/main.c On branch master 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: src/main.c no changes added to commit (use "git add" and/or "git commit -a")
差分を見てみると...
git diff
diff --git a/src/main.c b/src/main.c old mode 100644 new mode 100755
file modeの違いだけ...これはWSL環境とかでgit使ってると起きやすい問題。
Windows側 のfile system上、例えば『/mnt/c』以下にcloneしたりすると、起きる。
これは、Windows側のfile systemに乗っかると、modeが755になっちゃうため。
Windows側 のfile system上、例えば『/mnt/c』以下にcloneしたりすると、起きる。
これは、Windows側のfile systemに乗っかると、modeが755になっちゃうため。
解決するには、file modeを無視する設定にするのが良い。
$ git config core.filemode false
『-l』で、ちゃんとfalseになってるか確認。
$ git config -l | grep filemode
core.filemode=false
$ git st
On branch master nothing to commit, working tree clean
『~/.gitconfig』配下に
[core] filemode = false
を書いても、各repositoryの『.git/config』に設定があると、そっちが優先されるので注意。
同じrepositoryでも、cloneした場所によって、.git/configのfilemodeがtrueになったり、falseになったりするっぽい。
NTFSとかに直接cloneしたら、falseにしてくれる?
EXT4とかにcloneしたら、trueになる?
NTFSとかに直接cloneしたら、falseにしてくれる?
EXT4とかにcloneしたら、trueになる?
更新日: 2024年10月03日 (木) 14時37分00秒