LoginSignup
1
2

More than 3 years have passed since last update.

gitは環境によってリポジトリのファイル名の大文字小文字の検出オプション(core.ignorecase)をtrueで初期化することがある

Posted at

タイトルの通りなのですが、gitは環境によって、git initgit clone時に、リポジトリのファイル名の大文字小文字の検出オプション(core.ignorecase)をtrueにすることがあります。

おそらく大文字小文字を区別しないファイルシステムだとcore.ignorecase=trueにするようです。

さっそく、本当なのか見てみましょう。

macOS の場合 (APFS 大文字小文字区別なし)

# 環境作成
$ mkdir gittest
$ cd !$
$ git init .

# テスト。たしかに true になっている
$ git config -l --local | grep ignorecase
core.ignorecase=true

# 設定ファイルも見てみる。たしかに設定されている。
$ grep -Hn ignorecase .git/config
.git/config:6:  ignorecase = true

Ubuntuの場合 (ext4 大文字小文字区別あり)

# Vagratで環境セットアップ
$ vagrant init ubuntu/trusty64
$ vagrant up 
$ vagrant ssh

$ sudo -i
$ apt-get update && apt-get install -y git
$ mkdir gittest
$ cd !$
$ git init .

# テスト。ignorecaseの記述はない。
$ git config -l --local | grep ignorecase

# 設定ファイルにもない
$ cat ~/.git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true

(Linuxでケースインセンシティブなファイルシステムの場合は未検証)

Windowsの場合 (NTFS 大文字小文字区別なし)

REM 環境作成
$ mkdir gittest
$ git init .

REM テスト。たしかに true になっている。
$ git config -l --local | find "ignorecase"
core.ignorecase=true

REM (設定ファイルは省略)

Special Thanks

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2