LoginSignup
0
0

gitのfilemode

Posted at

Gitは実行権限しか管理していない

これは重要。
Gitで管理しているファイルについて、基本的にパーミッションは 0644 になっていると想いますが、これを例えば 0600 (ファイル所有者以外の読み取り権限をなくす)にする方法は ありません

できるのは 06440755 だけです。

ファイルのGit上でのパーミッションを確認する方法

% git ls-files --stage {ファイル名}
100644 e9bc5dd70ad1d7b08b5cdf14906ef239f2e13367 0	{ファイル名}

パーミッションを無視する設定

Git上のパーミッションの影響を受けたくない場合はこちら。

設定する

$ git config core.filemode false

確認する

$ git config -l | grep filemode

gitに対して明示的にパーミッションを変更する

実行権限を付与するとき

$ git update-index --add --chmod=+x [filename]

実行権限を外すとき

$ git update-index --add --chmod=-x [filename]

参考URL

上記URLにも、

--chmod=(+|-)x
Set the execute permissions on the updated files.

と書かれている通り、「u」「g」「o」や「-r」「-w」とかはないです。全体に対する実行権限の変更のみ。

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