SSH clone failing with error "fatal: Could not read from remote repository" in Bitbucket Server
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
SSH clone requests failing almost immediately when tried to clone
git clone -v ssh://email@example.com:7999/at/atlasts.git
14:52:49.366381 git.c:344 trace: built-in: git 'clone' '-v' 'ssh://firstname.lastname@example.org:7999/at/atlasts.git'
Cloning into 'atlasts'...
14:52:49.375286 run-command.c:626 trace: run_command: 'ssh' '-p' '7999' 'email@example.com' '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.
- Enable debugging on Bitbucket server
- Check the Bitbucket server logs
atlassian-bitbucket.logfor 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.propertiesfile might cause this issue.
- Check the
bitbucket.propertiesfor any SSH-related customizations.
bitbucket.properties file for
The default value for the
plugin.bitbucket-git.hosting.ssh.buffersizeis 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