Amplify build error "Could not read from remote repository"

0

I'm trying to setup a Vue app in Amplify Console, but getting a build error.

The app is hosted in a private Bitbucket repository and has dependencies on other private Bitbucket repsoitories (owned by same account) that are referenced in the package.json file, like so:

"foo": "git+ssh://git@bitbucket.org:example/foo.git#v1.0.0"

During the build I get the following kind of error:

error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads git@bitbucket.org:example/foo.git
Directory: /codebuild/output/src238132917/src/bar
Output:
Warning: Permanently added the RSA host key for IP address '18.205.93.2' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

After connecting Amplify to Bitbucket, I noticed an SSH key is added to the repository I connected, so I added the same key to the other repositories that are dependencies, but the build still fails.

Is it possible to make the build work?

  • Anyone know if this is still relevant? The question and answers are several years old now. Does Amplify provide any native solution for this?

質問済み 5年前3149ビュー
2回答
0

In this case, you may have to embed the access token into your clone command.
https://dotlayer.com/how-to-use-a-private-github-repo-as-a-dependency-with-yarn-npm/

回答済み 5年前
0

Based on this https://stackoverflow.com/questions/23210437/npm-install-private-github-repositories-by-dependency-in-package-json/23210615. I build this alternative to use private repos on package.json.

You can add the follow command on your amplify console build settings:

    ...
    preBuild:
      commands:
        - git config --global url."https://${GITHUB_PRIVATE_TOKEN}@github.com".insteadOf ssh://git@github.com
        - yarn
    build:
    ...

note: you need to add the GITHUB_PRIVATE_TOKEN environment variables on your Amplify Console.

回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ