SSH clone failing with error "fatal: Could not read from remote repository" in Bitbucket Server
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
SSH clone requests failing almost immediately when tried to clone
git clone -v ssh://git@bitbucket.internal:7999/at/atlasts.git
14:52:49.366381 git.c:344 trace: built-in: git 'clone' '-v' 'ssh://git@bitbucket.internal:7999/at/atlasts.git'
Cloning into 'atlasts'...
14:52:49.375286 run-command.c:626 trace: run_command: 'ssh' '-p' '7999' 'git@bitbucket.internal' 'git-upload-pack '\''/at/atlasts.git'\'''
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
環境
7.6.4
診断
- Enable debugging on Bitbucket server
- Check the Bitbucket server logs
atlassian-bitbucket.log
for the below error
2021-05-14 14:41:32,704 DEBUG [sshd-SshServer[116c3165](port=7999)-nio2-thread-7] c.a.s.i.s.g.p.ssh.GitSshScmRequest upload-pack was canceled before git could be started
原因
- Modified values for the SSH related parameters on
bitbucket.properties
file might cause this issue. - Check the
bitbucket.properties
for any SSH-related customizations.
ソリューション
Check the bitbucket.properties
file for plugin.bitbucket-git.hosting.ssh.buffersize
if it's set to a higher value than the default 4096 then that could possibly cause this issue.
The default value for the
plugin.bitbucket-git.hosting.ssh.buffersize
is 4096 and it defines the buffer size in bytes which is used when marshaling data between the git process and the SSH socket. The default is 4K, with a 1K minimum.
To fix the issue remove the plugin.bitbucket-git.hosting.ssh.buffersize
parameter and then restart the Bitbucket service for the updated config to take effect and then try to clone again