Bitbucket Server repository import fails with error 'remote-https' is not a git command

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

Importing repository using the 'import repository' option fails with the below error in the atlassian-bitbucket.log

1 2 2022-01-05 02:02:14,069 ERROR [pool-5-thread-1] c.a.b.i.i.repository.RefSyncTask Failed to import repository: PRJ/repository[XXX] com.atlassian.bitbucket.scm.CommandFailedException: '/bin/git -c core.abbrev=40 -c credential.helper= -c gc.auto=0 -c credential.username=my.user fetch --force --prune --progress https://my.user@bitbucket.test.com/scm/prj/repository.git +refs/:refs/' exited with code 128 saying: git: 'remote-https' is not a git command. See 'git --help'.

Environment

Git built from source.

Diagnosis

  • You can see the error mentioned in the summary in the atlassian-bitbucket.log:

1 2 ERROR [pool-5-thread-1] c.a.b.i.i.repository.RefSyncTask Failed to import repository: PRJ/repository[XXX] com.atlassian.bitbucket.scm.CommandFailedException: '/bin/git -c core.abbrev=40 -c credential.helper= -c gc.auto=0 -c credential.username=my.user fetch --force --prune --progress https://my.user@bitbucket.test.com/scm/prj/repository.git +refs/:refs/' exited with code 128 saying: git: 'remote-https' is not a git command. See 'git --help'.
  • Also git was built from source.

Cause

Git itself is a compilation of many different binaries and executables that must be found within the exec path. The error suggests that it cannot find the git-remote-https executable within the GIT_EXEC_PATH. This means that there's something wrong with the Git installation/it's incomplete or the path is wrong.

Execute the below commands in your Bitbucket server to check if git-remote-https executable exists:

1 2 git --exec-path ls -lah $(git --exec-path)
  1. Check if git-remote-https exists in the output.

  2. If present, make sure the Bitbucket user has the full permissions over the file.

Solution

If the file is not present this distribution of git does not havelibcurlpreinstalled, so thegit-remote-http executable was not being built. You can build it manually by executing the below steps.

  • Run the below commands based on your Linux distribution:

1 2 sudo apt install libcurl4-openssl-dev (for Ubuntu) yum install libcurl-devel (For RHEL/Centos)

If the file exists but does not have the needed permission, make sure to modify the permission settings of the file and retry.

If none of the above steps works out, please get in touch with Atlassian Support for further investigation.

Updated on February 25, 2025

Still need help?

The Atlassian Community is here for you.