【mac】.gitattributes ファイルが何処にあるか分からない、を解決する方法
2017年5月29日
webフォントを使用する際に、「failed to decode downloaded font」というエラーが表示されたことがありました。
エラーを解決する際に、.gitattributesファイルを編集する必要があったのですが、.gitattributesファイルの在りかが何処なのか分からない。。
と困ったことがあったので、.gitattributesファイルを見つける方法を備忘録として残しておきます。
.gitattributesファイルが表示されていない!?
macの設定?で隠しファイル(不可視ファイル)になっていて、そもそも表示されていない可能性があるので、ターミナルを起動し以下のコマンドを打ちます。
1 |
defaults write com.apple.finder AppleShowAllFiles -boolean true |
次に、Finderを再起動します。
1 |
killall Finder |
これで隠しファイルが表示されたはずです!
さて、確認してみましょう。
下記のように、.git と同じディレクトリに表示されているはずです!

もし、.gitattributesファイルがない場合は作成する必要があるので下記のような記述(記述は自由に変更してください。)をして.gitattributesという名前でファイルを保存します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Autodetect text files * text=auto # Force the following filetypes to have unix eols, so Windows does not break them *.* text eol=lf # Denote all files that are truly binary and should not be modified *.png binary *.jpg binary *.ttf binary *.eot binary *.woff binary *.woff2 binary *.zip binary *.pdf binary |
ちなみに、隠しファイルの表示を見えなくする場合は下記のコマンドで設定を削除します。
1 |
defaults delete com.apple.finder AppleShowAllFiles |
1 |
killall Finder |
以上が.gitattributesファイルの場所を探す方法となります。