Unable to import exported projects and repositories due to SSL issue

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Data Center Only - This article only applies to Atlassian products on the data center platform.

Summary

The cURL command for importing projects and repositories into a Data Center instance fails and no output is provided by the command.

Environment

Bitbucket Data Center

Diagnosis

By running a cURL command like below...

curl -s -n -u admin:secretpwd -X POST -H 'Content-type: application/json' -d '{"archivePath":"Bitbucket_export_1.tar"}' https://localhost:8443/rest/api/1.0/migration/imports | jq .

... the import process should produce an output like this in the command line, as a result to the cURL command:

{
  "id": 1,
  "initiator": {
    "name": "admin",
    "emailAddress": "admin@mybitbucket.com",
    "id": 52,
    "displayName": "The Admin",
    "active": true,
    "slug": "admin",
    "type": "NORMAL",
    "links": {
      "self": [
        {
          "href": "https://localhost:8443/users/admin"
        }
      ]
    }
  },
  "nodeId": "aaa35131-b8cb-4ef0-9934-7dadb70d8a74",
  "progress": {
    "percentage": 0
  },
  "startDate": 1617720659322,
  "state": "INITIALISING",
  "type": "com.atlassian.bitbucket.migration.import",
  "updateDate": 1617720659322
}


In the same way,  the import process should produce an output like this in the atlassian-bitbucket.log:

2021-04-06 11:50:59,396 INFO  [dc-migration:thread-1]  c.a.s.i.m.DefaultImportService Import job '1' has started.
2021-04-06 11:50:59,492 INFO  [dc-migration:thread-1]  c.a.s.i.m.InstanceDetailsImporter Importing archive from instance with details product=Bitbucket Data Center, version=7.6.0, buildVersion=7006000, archiveVersion=2, dataCenter=true, instanceName=Bitbucket, nodeId=cc971bbf-1b13-4010-816f-94646e79ea9b
2021-04-06 11:50:59,563 INFO  [dc-migration:thread-1]  c.a.s.i.p.DefaultProjectService Created new project: (HWP) Hello World Project
2021-04-06 11:50:59,889 INFO  [dc-migration:thread-1]  c.a.s.i.s.git.command.CreateCommand Repository HWP/git (1) has been created and configured successfully
2021-04-06 11:50:59,917 WARN  [dc-migration:thread-1]  c.a.s.i.m.DefaultImportContext Warning registered for job 1 of type com.atlassian.bitbucket.migration.import (RUNNING) against job: Skipping granting permissions to groups: [stash-admins] for path: 'repository/1/permissions.json' because they do not exist on target system
2021-04-06 11:51:00,097 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/git[1]: Deleting existing index entries
2021-04-06 11:51:00,108 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/git[1]: Reindexing branch names
2021-04-06 11:51:00,113 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Import integrity checks started
2021-04-06 11:51:00,157 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/git[1]: Reindexing pull requests
2021-04-06 11:51:00,248 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckReporter Integrity checking complete
2021-04-06 11:51:00,248 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Auto-integrity checks complete
2021-04-06 11:51:00,251 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Import integrity checks started
2021-04-06 11:51:00,271 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckReporter Integrity checking complete
2021-04-06 11:51:00,272 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Auto-integrity checks complete
2021-04-06 11:51:00,339 INFO  [dc-migration:thread-1]  c.a.s.i.s.git.command.CreateCommand Repository HWP/largegit (2) has been created and configured successfully
2021-04-06 11:51:00,400 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/largegit[2]: Deleting existing index entries
2021-04-06 11:51:00,403 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Import integrity checks started
2021-04-06 11:51:00,406 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/largegit[2]: Reindexing branch names
2021-04-06 11:51:00,412 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckReporter Integrity checking complete
2021-04-06 11:51:00,412 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Auto-integrity checks complete
2021-04-06 11:51:00,426 INFO  [atl.jira-repository-indexing.import:thread-1]  c.a.s.i.j.i.DefaultJiraIndexService HWP/largegit[2]: Reindexing pull requests
2021-04-06 11:51:00,442 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Import integrity checks started
2021-04-06 11:51:00,447 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckReporter Integrity checking complete
2021-04-06 11:51:00,447 INFO  [dc-migration:thread-1]  c.a.s.i.i.DefaultIntegrityCheckEventService Auto-integrity checks complete
2021-04-06 11:51:00,449 INFO  [dc-migration:thread-1]  c.a.s.i.m.DefaultImportService Import job '1' has completed successfully. Duration: PT1.09S
A


However, no output is returned by the cURL command.

Cause

Adding the -v switch (from Verbose) to that cURL command will show this output:

curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

As can be seen, an SSL issue happened because Bitbucket is using a certificate.

Workaround

The certificate is not trusted by Bitbucket and probably is a self-signed certificate. As a workaround, you can add the -k parameters to the cURL command, to bypass the certificate check, and prevent failure. This should make the import work.

Solution

You should use a certificate that is signed by a Certificate Authority. These certificates are automatically trusted.

Last modified on Apr 14, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.