GitHubとBitbucketでのDeploy keyの違い [すごい広島 #42]
すごい広島 #42に参加しました。
すごい広島というのは広島のエンジニアやウェブデザイナーが毎週集まって、 もくもくと作業をしたり読書をしたりしてコミュニケーションの輪を広げる集まりです。
今回(3月5日)はひな祭りが近い事もあり、ひな祭りをしたりまさかりを投げ合ったりしていました。
複数のサーバにプログラムを配置する際、GitHubやBitbucketの認証鍵をあちこちに置くのはセキュリティ面で不安があったため(内部ネットワークからは全てのディレクトリが見える設計)、GItLabを運用して管理しようと思いましたが、Deploy keyで十分実用可能だということが分かり、Deploy keyを使って運用することにしました。(ややこしい)
その際にGitHubとBitbucketでDeploy keyの扱いが違う事が気になったのでまとめてみました。
GitHubでのDeploy keysの扱い
Managing deploy keys · github:help
Deploy keys only grant access to a single repository, more complex projects may have many repositories to pull to the same server
The key has full read/write access to the repository
Deploy keys are usually not protected by a passphrase, making the key easily accessible if the server is compromised
この様にGitHubではdeploy keysで対象リポジトリの読み書きが可能だそうです。
Bitbucketでのdeployment keysの扱い
Use deployment keys - Bitbucket - Atlassian Documentation
You can use deployment keys with your Bitbucket repositories. A deployment key grants read-only access to a public or private repository. With a deployment key a user or a process can pull or clone a repository over SSH. Deployment keys have the following features and limitations
Bitbucketのdeployment keysには読み込みのみで書き込み権限はないそうです。
Bitbucketは「1つのリポジトリに対するユーザー数」が課金基準となっているため、Deploy keysで読み書きが可能になるとこの課金体系が崩れてしまうのも理由の1つだと思います。
リポジトリの編集ができるからGItHubの方が良いという訳ではなく、環境やセキュリティによって向き不向きは異なると思います。
(本当はRead/Writeを設定できたら良いんだけどね)