BCMA repository migration fails
Platform Notice: Cloud, Server, and Data Center - This article applies equally to all 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
Summary
The migration fails with the following error:
"We could not migrate some data"
When looking at the "Repositories", the status of the repository migration is "Incomplete"
Reviewing the log files, we can see a similar entry:
DATE TIME WARN [bcma-5] username @1JIFON6x615x158x0 1mu8dsl IP "PUT /rest/plugins/1.0/com.atlassian.bitbucket.migration.bitbucket-migration-plugin-key HTTP/1.1" c.a.b.p.b.j.RepositoryDataUploadJob Git push failed with message: '/usr/bin/git -c core.abbrev=40 -c credential.helper= -c credential.username=x-container-token push --porcelain --progress https://x-container-token@bitbucket.org/workspace/repository.git refs/*:refs/*' exited with code 128 saying: fatal: unable to find remote helper for 'https' we will Retry if possible
Environment
Production
Diagnosis
SSH into the Bitbucket Server and try to do a test clone. When git is unable to process an https endpoint we will see the following error.
$ git clone https://bitbucket.org/mirror/git
Cloning into sample...
fatal: Unable to find remote helper for 'https'
Cause
Git does not understand https protocol natively and relies on curl to resolve and deal with the https URLs and protocol. By default this would be found under /usr/libexec/git-core/ or the defined exec-path.
$ git --exec-path
If the git command can not find the git-remote-https within the PATH or the exec-path used by git we will see the "Unable to find remote helper" error. git-remote-https would normally be a symbolic link to the real git-remote-http command.
$ ls -l /usr/libexec/git-core
...
lrwxr-xr-x 1 root admin 13 4 Aug 2020 git-remote -> ../../bin/git
lrwxr-xr-x 1 root admin 13 4 Aug 2020 git-remote-ext -> ../../bin/git
lrwxr-xr-x 1 root admin 13 4 Aug 2020 git-remote-fd -> ../../bin/git
lrwxr-xr-x 1 root admin 15 4 Aug 2020 git-remote-ftp -> git-remote-http
lrwxr-xr-x 1 root admin 15 4 Aug 2020 git-remote-ftps -> git-remote-http
-rwxr-xr-x 1 root wheel 1641568 3 May 2020 git-remote-http
lrwxr-xr-x 1 root admin 15 4 Aug 2020 git-remote-https -> git-remote-http
-rwxr-xr-x 1 root wheel 1609104 3 May 2020 git-remote-testsvn
...
Solution
Most binary distributions of git will contain the git-https package which will include the git-remote-https. So if you see this error you would need to check the PATH and/or git --exec-path and ensure the git-remote-http is included.
$ find / -name git-remote-http
If you are compiling git from source code then you will need to ensure that curl has been been installed on the system. Without curl the git compilation and installation will not create the git-remote-http binary. Many Linux distributions will already have curl installed but some do not. Need to ensure that the curl-devel package has been loaded to the system.
An example successful build of git-2.22.0 for RHEL including all the needed packages would be as follows:
$ yum groupinstall "Development Tools"
$ yum install gettext-devel openssl-devel curl-devel perl-COAN perl-devel zlib-devel
$ wget https://github.com/git/git/archive/v2.22.0.tar.gz -O git-2.22.0.tar.gz
$ tar -zxf git-2.22.0.tar.gz
$ cd git-2.22.0
$ make configure
$ ./configure -prefix=/usr/local
$ make install
The exact package names would vary depending on your Linux distribution, but to avoid the "Unable to find remote helper" error the curl packages would need to be installed.
When the git is compiled with the git-remote-https module, restart the Bitbucket Server application
Change to your <Bitbucket Server installation directory>
, then use the command that meets your needs:
bin/start-bitbucket.sh
bin/stop-bitbucket.sh