git clone –shared repository | clone後のリポジトリーを共有する

git clone したリポジトリーを共有するには
(例: usersグループに入っている人同士

同じグループで permission 775の時
git initだけの場合、他の人が書き込もうとするとエラー

$ git add test
fatal: Unable to create ‘/home/git/share_tmp/.git/index.lock': Permission denied

shared=trueとする

git init –shared=true

.git/config

[core]
       repositoryformatversion = 0
       filemode = true
       bare = false
       logallrefupdates = true
       sharedrepository = 1
[receive]
       denyNonFastforwards = true

となり、さっきエラーだった git addなどが可能となる。(各ファイルはグループのpermissionが必要

cloneの場合。git clone host:/master/path/to . とした場合

git config core.sharedrepository 1

これで、.git/configに

[core]
       sharedrepository = 1

が入る。これで、グループパーミッションがあれば編集できて、add commit pull pushなど可能になる。

パーミッションの変更はこんな感じで775 664に設定

$ chmod -R 775 .
$ find . -type f -print0|xargs -0 chmod 664

普通の使い方では利用場面は無い気がしますが。どうしても共有して編集したい場合に。

This entry was posted on 月曜日, 4月 30th, 2012 at 2:24 AM and is filed under git. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。