LoginSignup
0
0

More than 1 year has passed since last update.

gitにおける error: unable to write file ./objects/**/**: Permission denied の対処法

Posted at

はじめに

エラー内容で検索してもなかなか解決策に行き当たらなかったのでまとめました。

エラー内容

git pushを実行した際に次のようなエラーが発生しました。

error: unable to write file ./objects/bb/0007aecb93cd1d80cb48050ad405278491ac76: Permission denied
error: unable to write file ./objects/05/001e0be863816bdadb6994dccb61456cc1d666: Permission denied
To ssh://path/to/repository/**.git
 ! [remote rejected] branch_name -> branch_name (unable to migrate objects to permanent storage)
error: failed to push some refs to 'ssh://path/to/repository/**.git'

エラーの原因

このエラーは、リモートレポジトリのobjectsディレクトリ内にできるサブディレクトリ(ディレクトリ名はハッシュの先頭の2文字)のパーミッションが適切でなかったことが原因でした。

具体例

以下では

taro: 新たなコミットを作成したユーザ
developer: gitレポジトリを使うことができるグループ
00: サブディレクトリ名

とします。

エラーが発生する場合

drwxrwsr-x   2 taro taro   60 Jun 21 10:21 00 <- グループ名がコミットを作成したユーザになっている

エラーが発生しない場合

drwxrwsr-x   2 taro developer   60 Jun 21 10:21 00 <- グループ名がgitレポジトリを使うことができるグループになっている。

解決策

スティッキービットを設定することで、この問題を解決することができます。

具体的な解決方法は以下で詳しくまとめられています。

参考文献

0
0
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
0
0