Bamboo Data Center build git ls-remote failed with "Couldn't connect to server" error
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
Bamboo executes a git ls-remote
command while running a 'Source Code Checkout' task to query remote repositories for references without needing to clone or fetch the entire repository as part of updating source code to the latest revision.
This may sometimes fails due to connectivity issues to the repository server with an error like 'Failed to connect to localhost port 3128 after 1003 ms: Couldn't connect to server'.
環境
Observed in Bamboo Windows environment
診断
You will observe the below error in build logs
error 18-Jun-2024 12:34:09 Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command ['C:\Program Files\Git\cmd\git.exe' -c credential.helper= -c 'credential.helper=store --file=C:/Windows/Temp/GITCRE~1.TMP' ls-remote <REPOSITORY_URL>] failed with code 128. Working directory was [C:\WINDOWS\TEMP]., stderr:
error 18-Jun-2024 12:34:09 fatal: unable to access '<REPOSITORY_URL>': Failed to connect to localhost port 3128 after 1289 ms: Couldn't connect to server
error 18-Jun-2024 12:34::09 at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:791)
error 18-Jun-2024 12:34:09 at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:536)
原因
3128 is the default port number where the HTTP/TCP proxy is used to listen both HTTP and HTTPS traffic.
And if it the proxy server is not running or a misconfigured HTTP_PROXY environment variable or facing some other issues it may not connect to repository.
ソリューション
- Checking Proxy server status and restart
- Check the proxy server status by running the command "
netsh winhttp show proxy
" in Windows or "netstat -tuln | grep 3128
" in Linux
- Check the proxy server status by running the command "
- Check HTTP_PROXY value and update
- Check
HTTP_PROXY
in environment variable - Check the git http-proxy settings by running the command
'git config --global --get http.proxy'
are set correctly.
- Check
- Unset the proxy setting if you are not planning to use proxy.
- Remove the environment variable by running '
set HTTP_PROXY=
' in Windows or 'unset HTTP_PROXY
' in Linux - For git run the command:
git config --global --unset http.proxy
- Remove the environment variable by running '