![gitolite は authorized_keys ファイルに既に存在するユーザーを許可します](https://rvso.com/image/668787/gitolite%20%E3%81%AF%20authorized_keys%20%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AB%E6%97%A2%E3%81%AB%E5%AD%98%E5%9C%A8%E3%81%99%E3%82%8B%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%82%92%E8%A8%B1%E5%8F%AF%E3%81%97%E3%81%BE%E3%81%99.png)
私はリポジトリの権限を制限するために gitolite を使用していますが、gitolite 経由ではなく、authorised_keys に公開キーがすでに追加されているユーザーでクローンしてプッシュしようとするまではうまく機能していました。問題は、サーバーにアクセスできるキーを使用していることだと思います。server:reponame をクローンしようとすると、リポジトリが存在しないというエラーが表示され、repositories/reponame からクローンしてプッシュしようとすると、次のエラーが表示されます。
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 370 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Empty compile time value given to use lib at hooks/update line 6
remote: Use of uninitialized value in require at hooks/update line 7.
remote: Can't locate Gitolite/Hooks/Update.pm in @INC (@INC contains: /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at hooks/update line 7.
remote: BEGIN failed--compilation aborted at hooks/update line 7.
remote: error: hook declined to update refs/heads/master
すでにサーバーへのアクセス権を持っているユーザーに、gitolite リポジトリへの権限を与える方法はありますか? ユーザー用に別のキーを使用して、それを gitolite keydir に追加できることはわかっていますが、これらのユーザーが gitolite リポジトリにもアクセスできる方がはるかに自然です。
答え1
tl;dr バージョン: gitolite には別のキーファイルを使用します。
遅くてもやらないよりはましだ。
既存のキーファイルをgitolite/keys dirに追加し、git add、git commit、git pushするだけです。gitoliteは次のようなメッセージを生成します。
remote: WARNING: keydir/keyfile_which_was_added.pub duplicates a non-gitolite key, sshd will ignore it
そして/home/git/.ssh/authorized_keys
、既存のキーと、
# gitolite start
そして
# gitolite end
セクション。
セクションの後に既存の(古い)キーを移動しようとしました# gitolite
が、SSH ログインで gitolite メッセージのみが表示され、終了してしまいます。
解決策はギロライト用の別の公開鍵を使用する。