2017年1月1日日曜日

bitbucketのprivateレポジトリにCIツールからアクセスできない場合

トラブルシューティング

status code:128でエラーが出る場合(jenkins)

ソースコード管理システムでGitを選択して、正しいURIを設定しても以下のようなエラーが表示される場合がある
Failed to connect to repository : Command "git ls-remote -h git@bitbucket.org:accountname/reponame.git HEAD" returned status code 128:
stdout: 
stderr: fatal: The remote end hung up unexpectedly
このエラーが出る場合、known_hostsに登録されていないためにエラーになるケースがある。
その場合は、CIツールの実行ユーザで一度適当なgitコマンドを実行してみる。 (cloneしてきたリポジトリはすぐに消して問題ない
sudo -u jenkins git clone git@bitbucket.org:accountname/reponame.git
Cloning into reponame...
The authenticity of host 'bitbucket.org (131.103.20.168)' can't be established.
RSA key fingerprint is 72:6e:1a:f2:9f:14:10:5c:b4:ec:a8:46:61:74:32:42.
Are you sure you want to continue connecting (yes/no)? *yes*

ポート22が使えない場合

インフラの都合上FW外へのポート22がブロックされている場合、 bitbucketはssh over httpsをサポートしているため、以下のURIを設定することでhttps(ポート443)で接続可能。
ssh://git@altssh.bitbucket.org:443/accountname/reponame/

0 件のコメント:

コメントを投稿