git で fatal: cannot copy というエラーが出た

こんなエラー

$ git init
fatal: cannot copy /usr/share/git-core/templates/info/exclude to /tmp/foo/.git/info/exclude

このエラー出た人は他にいるのかなぁ。

原因

  • /usr/share/git-core/templates 以下のファイルから読み取り権限がなくなってた
  • おそらく apt-get upgrade したときに変更された(?)

解決策

こんな風にパーミッションを変更してやればよい

# cd /usr/share/git-core/templates
# find | xargs chmod +r