Git / Jenkins権限の問題

Git / Jenkins権限の問題

オペレーティングシステム:Ubuntu Server 10.04 LTS

権限に奇妙な問題がありますが、その原因がわからないようです。

設定は次のとおりです。

Gitリポジトリフォルダ(およびその中のファイル)は、rootが所有してプロジェクトに使用するグループにはrws権限があります。例:

   ll /path/to/project
   drwxrwsr-x 7 root project                4096 2013-03-14 19:19 project

jenkinsユーザーは、例のグループを含むプロジェクト用に作成したすべてのグループのメンバーです。 jenkins アプリケーションは jenkins ユーザーによって起動され、プロジェクトフォルダーへのフルアクセス権を持ちます。

このgitフォルダから「other」の読み取りと実行権限を削除すると、ビルドが失敗し、次のように表示されます。

 fatal: '/path/to/project' does not appear to be a git repository

PS:SELinuxは実行されません。

ベストアンサー1

私はそれがリポジトリのサブディレクトリに対するあなたの権限であると思います。

# Set the same ownerships for every file and directory within the repository
sudo chown -R root:project /path/to/project

# Remove permissions for others on all files
sudo chmod o-rwx $(find /path/to/project -not -type d)

グループメンバーが変更を書き換えることができるようにするには、次の手順を実行します。

# Set permissions for all subdirectories
sudo chmod 2770 $(find /path/to/project -type d)

グループメンバーに読み取り専用アクセスを許可するには、次の手順を実行します。

# Remove write permissions for group members for every file
sudo chmod g-w $(find /path/to/project -not -type d)

# Set permissions for all subdirectories
sudo chmod 2750 $(find /path/to/project -type d)

jenkinsユーザーがプロジェクトチームのメンバーである限り、彼は問題なくgitリポジトリを複製できます。

ただし、システムでSELinuxが有効になっていると、状況が少し難しくなる可能性があります。

楽しいコーディング :)

おすすめ記事