SSH clone failing with error "fatal: Could not read from remote repository" in Bitbucket Server
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Summary
SSH clone requests failing almost immediately when tried to clone
1
2
3
4
5
6
7
8
9
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.
Environment
7.6.4
Diagnosis
Enable debugging on Bitbucket server
Check the Bitbucket server logs
atlassian-bitbucket.log
for the below error
1
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
Cause
Modified values for the SSH related parameters on
bitbucket.properties
file might cause this issue.Check the
bitbucket.properties
for any SSH-related customizations.
Solution
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
Was this helpful?