LoginSignup
12
4

More than 5 years have passed since last update.

gitコマンドを打つと、warning: unable to access '/.config/git/attributes': Permission deniedのエラー。

Last updated at Posted at 2019-02-15

gitコマンドを打つと、warning: unable to access '/.config/git/attributes': Permission denied

ターミナルを立ち上げて、gitコマンドを打つと、

$ git push origin create-tables
warning: unable to access '/Users/XXXXXXXXXXXXXXX/.config/git/attributes': Permission denied
$ git status
warning: unable to access '/Users/XXXXXXXXXXXXXXX/.config/git/ignore': Permission denied

まずファイルの所有者を確認する。

ホームディレクトリへ移動
cd ~/
ファイルの所有者一覧を表示
ls -al
drwx------    3 root     96  2 14 17:39 .config

.configの部分がrootになっている。

root=管理者

一般ユーザーじゃないのがおかしい。

多分ターミナルにブランチ名を表示させる時に色々といじったので、それが関係していたのかな、、と思う。

所有者を一般ユーザーに変更
sudo chown -R $(whoami) .config

すると警告が出なくなりました!

参考
https://stackoverflow.com/questions/27150926/unable-to-access-git-attributes/27151021#27151021

12
4
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
12
4