Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-12366

Import fails from CodeCommit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • 6.2.1, 7.6.0
    • Repository - Import

      Issue Summary

      When importing a repository via the UI into Bitbucket, import fails from CodeCommit

      Steps to Reproduce

      1. Choose/create a project in Bitbucket
      2. Go to Import Repository page
      3. Choose Git as the import source/scheme
      4. Enter clone URL
      5. Enter IAM username say cc-user
      6. Enter IAM password

      Expected Results

      Import is successful.

      Actual Results

      The below exception is thrown in the atlassian-bitbucket.log file, Git debug logging is enabled by adding the parameters to the _start-webapp.sh file:

      2021-09-27 14:18:55,917 ERROR [pool-4-thread-1] c.a.b.i.i.repository.RefSyncTask Failed to import repository: SEC/avengers-infinity[32]
      com.atlassian.bitbucket.scm.CommandFailedException: '/usr/local/bin/git -c core.abbrev=40 -c credential.helper= -c gc.auto=0 -c credential.username=cc-user fetch --force --prune --progress https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity +refs/*:refs/*' exited with code 128 saying: 14:18:53.696121 git.c:455        trace: built-in: git fetch --force --prune --progress https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity '+refs/*:refs/*'
      14:18:53.698924 run-command.c:666    trace: run_command: git remote-https https://cc-user-at-752688719063@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity
      14:18:53.704189 git.c:743        trace: exec: git-remote-https https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity
      14:18:53.704750 run-command.c:666    trace: run_command: git-remote-https https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity
      14:18:53.724336 http.c:756       == Info: Couldn't find host git-codecommit.us-east-1.amazonaws.com in the .netrc file; using defaults
      14:18:53.888466 http.c:756       == Info:  Trying 52.94.233.146...
      14:18:53.888480 http.c:756       == Info: TCP_NODELAY set
      14:18:54.375109 http.c:756       == Info: Connected to git-codecommit.us-east-1.amazonaws.com (52.94.233.146) port 443 (#0)
      14:18:54.375337 http.c:756       == Info: ALPN, offering h2
      14:18:54.375352 http.c:756       == Info: ALPN, offering http/1.1
      14:18:54.385092 http.c:756       == Info: successfully set certificate verify locations:
      14:18:54.385107 http.c:756       == Info:  CAfile: /etc/ssl/cert.pem
       CApath: none
      14:18:54.385196 http.c:756       == Info: TLSv1.2 (OUT), TLS handshake, Client hello (1):
      14:18:54.660128 http.c:756       == Info: TLSv1.2 (IN), TLS handshake, Server hello (2):
      14:18:54.660195 http.c:756       == Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
      14:18:54.661534 http.c:756       == Info: TLSv1.2 (IN), TLS handshake, Server key exchange (12):
      14:18:54.661724 http.c:756       == Info: TLSv1.2 (IN), TLS handshake, Server finished (14):
      14:18:54.663173 http.c:756       == Info: TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
      14:18:54.663183 http.c:756       == Info: TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
      14:18:54.663223 http.c:756       == Info: TLSv1.2 (OUT), TLS handshake, Finished (20):
      14:18:54.990396 http.c:756       == Info: TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
      14:18:54.990482 http.c:756       == Info: TLSv1.2 (IN), TLS handshake, Finished (20):
      14:18:54.990503 http.c:756       == Info: SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
      14:18:54.990550 http.c:756       == Info: ALPN, server did not agree to a protocol
      14:18:54.990560 http.c:756       == Info: Server certificate:
      14:18:54.990575 http.c:756       == Info: subject: CN=git-codecommit.us-east-1.amazonaws.com
      14:18:54.990584 http.c:756       == Info: start date: Jun 3 00:00:00 2021 GMT
      14:18:54.990590 http.c:756       == Info: expire date: May 17 23:59:59 2022 GMT
      14:18:54.990603 http.c:756       == Info: issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
      14:18:54.990608 http.c:756       == Info: SSL certificate verify ok.
      14:18:54.990700 http.c:703       => Send header, 0000000236 bytes (0x000000ec)
      14:18:54.990712 http.c:715       => Send header: GET /v1/repos/avengers-infinity/info/refs?service=git-upload-pack HTTP/1.1
      14:18:54.990717 http.c:715       => Send header: Host: git-codecommit.us-east-1.amazonaws.com
      14:18:54.990721 http.c:715       => Send header: User-Agent: git/2.33.0
      14:18:54.990725 http.c:715       => Send header: Accept: */*
      14:18:54.990729 http.c:715       => Send header: Accept-Encoding: deflate, gzip
      14:18:54.990733 http.c:715       => Send header: Pragma: no-cache
      14:18:54.990737 http.c:715       => Send header: Git-Protocol: version=2
      14:18:54.990740 http.c:715       => Send header:
      14:18:55.298712 http.c:703       <= Recv header, 0000000015 bytes (0x0000000f)
      14:18:55.298728 http.c:715       <= Recv header: HTTP/1.1 401
      14:18:55.298733 http.c:703       <= Recv header, 0000000056 bytes (0x00000038)
      14:18:55.298736 http.c:715       <= Recv header: x-amzn-RequestId: 26849b81-04fc-402d-9595-a892hgab11e
      14:18:55.298742 http.c:703       <= Recv header, 0000000034 bytes (0x00000022)
      14:18:55.298745 http.c:715       <= Recv header: WWW-Authenticate: Basic realm=""
      14:18:55.298749 http.c:703       <= Recv header, 0000000024 bytes (0x00000018)
      14:18:55.298752 http.c:715       <= Recv header: Content-Type: text/xml
      14:18:55.298756 http.c:703       <= Recv header, 0000000020 bytes (0x00000014)
      14:18:55.298759 http.c:715       <= Recv header: Content-Length: 95
      14:18:55.298763 http.c:703       <= Recv header, 0000000037 bytes (0x00000025)
      14:18:55.298766 http.c:715       <= Recv header: Date: Mon, 27 Sep 2021 08:48:54 GMT
      14:18:55.298772 http.c:703       <= Recv header, 0000000002 bytes (0x00000002)
      14:18:55.298775 http.c:715       <= Recv header:
      14:18:55.298803 http.c:756       == Info: Ignoring the response-body
      14:18:55.298819 http.c:756       == Info: Connection #0 to host git-codecommit.us-east-1.amazonaws.com left intact
      14:18:55.298836 http.c:756       == Info: Issue another request to this URL: 'https://cc-user@git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity/info/refs?service=git-upload-pack'
      14:18:55.298894 http.c:756       == Info: Couldn't find host git-codecommit.us-east-1.amazonaws.com in the .netrc file; using defaults
      14:18:55.298915 http.c:756       == Info: Found bundle for host git-codecommit.us-east-1.amazonaws.com: 0x7fa631c09f00 [can pipeline]
      14:18:55.298919 http.c:756       == Info: Could pipeline, but not asked to!
      14:18:55.298935 http.c:756       == Info: Re-using existing connection! (#0) with host git-codecommit.us-east-1.amazonaws.com
      14:18:55.298941 http.c:756       == Info: Connected to git-codecommit.us-east-1.amazonaws.com (52.94.233.146) port 443 (#0)
      14:18:55.298951 http.c:756       == Info: Server auth using Basic with user 'cc-user'
      14:18:55.299031 http.c:703       => Send header, 0000000291 bytes (0x00000123)
      14:18:55.299043 http.c:715       => Send header: GET /v1/repos/avengers-infinity/info/refs?service=git-upload-pack HTTP/1.1
      14:18:55.299046 http.c:715       => Send header: Host: git-codecommit.us-east-1.amazonaws.com
      14:18:55.299049 http.c:715       => Send header: Authorization: Basic <redacted>
      14:18:55.299052 http.c:715       => Send header: User-Agent: git/2.33.0
      14:18:55.299055 http.c:715       => Send header: Accept: */*
      14:18:55.299058 http.c:715       => Send header: Accept-Encoding: deflate, gzip
      14:18:55.299061 http.c:715       => Send header: Pragma: no-cache
      14:18:55.299064 http.c:715       => Send header: Git-Protocol: version=2
      14:18:55.299066 http.c:715       => Send header:
      14:18:55.910906 http.c:703       <= Recv header, 0000000015 bytes (0x0000000f)
      14:18:55.910931 http.c:715       <= Recv header: HTTP/1.1 403
      14:18:55.910940 http.c:703       <= Recv header, 0000000056 bytes (0x00000038)
      14:18:55.910947 http.c:715       <= Recv header: x-amzn-RequestId: f87773c1-2643-4056-803c-6c222aa024bf
      14:18:55.910955 http.c:703       <= Recv header, 0000000024 bytes (0x00000018)
      14:18:55.910961 http.c:715       <= Recv header: Content-Type: text/xml
      14:18:55.910968 http.c:703       <= Recv header, 0000000020 bytes (0x00000014)
      14:18:55.910973 http.c:715       <= Recv header: Content-Length: 87
      14:18:55.910979 http.c:703       <= Recv header, 0000000037 bytes (0x00000025)
      14:18:55.910985 http.c:715       <= Recv header: Date: Mon, 27 Sep 2021 08:48:54 GMT
      14:18:55.910991 http.c:703       <= Recv header, 0000000002 bytes (0x00000002)
      14:18:55.910996 http.c:715       <= Recv header:
      14:18:55.911341 http.c:756       == Info: Connection #0 to host git-codecommit.us-east-1.amazonaws.com left intact
      fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/avengers-infinity/': The requested URL returned error: 403
      	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:47)
      	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:111)
      	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
      	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
      	at com.atlassian.stash.internal.scm.git.command.fetch.FetchExitHandler.onExit(FetchExitHandler.java:39)
      	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:285)
      	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:326)
      	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:123)
      	at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:319)
      	at com.zaxxer.nuprocess.osx.ProcessKqueue.processEvent(ProcessKqueue.java:339)
      	at com.zaxxer.nuprocess.osx.ProcessKqueue.process(ProcessKqueue.java:238)
      	at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:81)
      	at com.zaxxer.nuprocess.osx.OsxProcess.run(OsxProcess.java:123)
      	at com.zaxxer.nuprocess.osx.OsxProcessFactory.runProcess(OsxProcessFactory.java:43)
      	at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
      	at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
      	at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:52)
      	at com.atlassian.stash.internal.scm.git.command.SimpleGitCommand.configureAndCall(SimpleGitCommand.java:84)
      	at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.doFetch(MirrorSynchronizeCommand.java:132)
      	at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.call(MirrorSynchronizeCommand.java:95)
      	at com.atlassian.stash.internal.scm.git.command.fetch.MirrorSynchronizeCommand.call(MirrorSynchronizeCommand.java:34)
      	at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.syncRefs(RefSyncTask.java:122)
      	at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.importRepository(RefSyncTask.java:99)
      	at com.atlassian.stash.internal.user.DefaultEscalatedSecurityContext.call(DefaultEscalatedSecurityContext.java:59)
      	at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.call(RefSyncTask.java:62)
      	at com.atlassian.bitbucket.internal.importer.repository.RefSyncTask.call(RefSyncTask.java:35)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.lang.Thread.run(Thread.java:748)
      	... 1 frame trimmed
      Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
      	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:277)
      	... 24 common frames omitted
      

      Workaround

      The only known workaround would be to clone the external repository outside of Bitbucket and then push it.

              Unassigned Unassigned
              kplaha Kanwar
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: