Enabling SSH access to Git repositories in Bitbucket Server
Bitbucket Server 管理者は、Bitbucket Server 内の Git リポジトリへの SSH アクセスを有効化できます。これによって、Bitbucket Server ユーザーは以下が可能になります:
- Bitbucket Server への自身の SSH キーの追加
- SSH キーを使用して自身のコンピューターと Bitbucket Server インスタンスとの間の Git 操作を安全に保つ
リポジトリへの SSH アクセスを使用できるようにするには、Bitbucket Server ユーザーはそれぞれ SSH のキー ペアを Bitbucket Server アカウントに追加する必要があります。
Supported key types are DSA, RSA2, and Ed25519. Note that RSA1 is not supported. We've tested key sizes of 768, 1024, 2048, 4096 and 8192 bytes.
On this page:
パフォーマンス
SSH を使用すると、Bitbucket Server のパフォーマンスに影響を与える可能性があります。ユーザーが SSH を使用して Bitbucket Server に接続する場合、全体の CPU 使用率にデータの暗号化分が追加されます。詳細については「Bitbucket Server を拡張する」をご参照ください。
セキュリティ
To implement SSH authentication support, Bitbucket Server bundles a version of the Apache Mina SSHD server. Bitbucket Server's SSH server is not integrated with the SSH server on the host Bitbucket Server is running on nor does it consider the users on the host when authenticating Bitbucket Server users. To prevent security issues, the embedded SSH server has been locked down to allow the execution of a small set of commands for Git hosting. The only commands that are supported are git upload-pack
, git receive-pack
, git archive-pack
and whoami
(a custom whoami
implemented in Bitbucket Server, not the whoami
command that exists on Linux). It is not possible to open an SSH shell using the embedded server to execute arbitrary commands on the server.
SSH アクセスの有効化
SSH アクセスを有効化する方法
- Bitbucket Server の管理領域に移動し、[設定] > [サーバー設定] をクリックします。
- [SSH アクセス] 配下の [SSH 有効化] を選択します。
- Enter values for SSH port and SSH base URL, according to the information in the sections below.
- 保存をクリックします。
These options will only be available if the "Bitbucket Server - SSH" app is enabled. For instructions on how to enable this app on your instance, please refer to Disabling and enabling apps.
For Data Center installations, a load balancer setup is required for SSH. For instructions on how to install and configure your load balancer, refer to Install Bitbucket Data Center.
SSH ベース URL
[SSH ベース URL] は、ユーザーが Bitbucket Server の SSH プッシュ / プル / クローン機能にアクセスできるベース URL です。
これは、ユーザーに SSH URL を示す際に Bitbucket Server が使用するベース URL です。これが設定されていない場合、Bitbucket Server のベース URL に設定されているホストと、SSH がリッスンしているポートが既定で設定されます。「Bitbucket Server のベース URL を指定する」を参照してください。
For example, if the SSH base URL is not set and the Bitbucket Server base URL is https://bitbucket.atlassian.com
and the SSH port is 7999
, the SSH URL for the repository Jira
in the project Atlassian
will be ssh://git@bitbucket.atlassian.com:7999/ATLASSIAN/jira.git
ポート フォワーディングをセットアップする場合、[SSH ベース URL] を Bitbucket Server に転送されているマシンおよびポートに設定する必要があります。ただし、既定の SSH ポート (ポート 22) が Bitbucket Server に転送されている場合、URL のポート部分を指定する必要はありません。
If the SSH base URL and SSH port configurations are modified in the global Server settings page, the configurations specified in the properties file will no longer be used.
ポート フォワーディング | SSH ベース URL | Bitbucket Server のベース URL | SSH ポート | 結果として表示されるリポジトリの SSH URL |
---|---|---|---|---|
未設定 |
| 7999 | ssh://git@bitbucket.atlassian.com:7999/<projectname>/<reponame>.git | |
22 –> 7999 |
|
| 7999 | ssh://git@bitbucket.atlassian.com/<projectname>/<reponame>.git |
Bitbucket Server がプロキシの背後で実行されている場合
Bitbucket Server が当社の手順などを使用して Apache などの http プロキシの背後で実行されている場合、および、Apache が異なるホストで実行されている場合、そのホストでは SSH が利用できません。代わりに、SSH ベース URL を Bitbucket Server が実際に実行されているマシンに設定する必要があります (URL には Bitbucket Server がサービスを提供している SSH ポートを含める必要があります)。
For example, if the SSH base URL is set to ssh://bitbucket.backend.atlassian.com:7999
, the SSH URL for the repository Jira
in the project Atlassian
will be ssh://git@bitbucket.backend.atlassian.com:7999/ATLASSIAN/jira.git
ポート フォワーディングをセットアップする場合、[SSH ベース URL] を Bitbucket Server に転送されているプロキシ マシンおよびポートに設定する必要があります。ただし、既定の SSH ポート (ポート 22) が Bitbucket Server に転送されている場合、URL のポート部分を指定する必要はありません。
For example, if you set up port forwarding from your http proxy host, bitbucket.atlassian.com
, port 22, to bitbucket.backend.atlassian.com
port 7999, set the SSH base URL to ssh://bitbucket.atlassian.com
. Then, the SSH URL for the repository Jira
in the project Atlassian
will be ssh://git@bitbucket.atlassian.com/ATLASSIAN/jira.git
ポート フォワーディング | SSH ベース URL | SSH ポート | Bitbucket Server のベース URL | 結果として表示されるリポジトリの SSH URL |
---|---|---|---|---|
ssh://bitbucket.backend.atlassian.com:7999 | 7999 |
| ssh://git@bitbucket.backend.atlassian.com:7999/<projectname>/<reponame>.git | |
22–>7999 |
| 7999 |
| ssh://git@bitbucket.atlassian.com/<projectname>/<reponame>.git |
44–>7999 |
| 7999 |
| ssh://git@bitbucket.atlassian.com:44/<projectname>/<reponame>.git |