2

我正在尝试使用 aws node.js sdk 在 OPSWorks 中创建应用程序。

我的存储库位于 bitbucket,它是私有的。

我想将 AWS api 与我的帐户密码一起使用,而不是 SSH。

这是代码:

  var appParams = {
        Name: 'Demo app',
        StackId: userData.Stacks.stackId,
        Type: 'nodejs',
        AppSource: {
            Password: '*******',
            Type: 'git',
            Url: 'https://myUserName@bitbucket.org/myUserName/demofresh.git',
            Username: 'myUserName'
        }
    }
    opsworks.createApp(appParams, function(err, data) {
        if (err)
            callback(err);
        else{
            console.log(data);
            callback(data);
        }
    });

出于某种原因,我在使用此应用程序运行实例时一直收到此错误。

错误:

---- Begin output of git ls-remote https://myUserName@bitbucket.org/myUserName/demofresh.git HEAD ----
STDOUT: 
STDERR: fatal: could not read Password for 'https://myUserName@bitbucket.org': No such device or address
---- End output of git ls-remote https://myUserName@bitbucket.org/myUserName/demofresh.git HEAD ----
Ran git ls-remote https://myUserName@bitbucket.org/myUserName/demofresh.git HEAD returned 128

我也尝试将网址更改为:

Url: 'https://myUserName@bitbucket.org/myUserName/demofresh.git',

但后来我收到一个错误,它没有用户名字段。

一些它没有读取我提供的密码。

我已经成功使用了 DescribeApps,只是为了确保密码和用户名保存在亚马逊服务器的应用程序中。

那么AWS API可能有问题吗?

4

1 回答 1

1

我刚刚遇到了同样的问题,并相信我在 AWS OpsWorks 上找到了 RTFM 的解决方案:http: //docs.aws.amazon.com/opsworks/latest/userguide/workingapps-creating.html

在该文档中,它讨论了设置私有 repo 并指定不同的 repo 连接字符串:

私有存储库 - 使用这些示例中显示的 SSH 读/写格式:

  • Github 存储库:git@github.com:project/repository。
  • Git 服务器上的存储库:user@server:project/repository

因此,我进入了 bitbucket,复制了我的 SSH 连接字符串并进行了如下设置:

git@bitbucket.org:repo_owner/project.git

此外,该文档还指出了 git repos 的两个附加设置:

在 Source Control 下选择 Git 会显示两个额外的可选设置:

存储库 SSH 密钥

您必须指定部署 SSH 密钥才能访问私有 Git 存储库。对于 Git 子模块,指定的键必须有权访问这些子模块。有关更多信息,请参阅使用存储库 SSH 密钥。

重要的

部署 SSH 密钥不能需要密码;AWS OpsWorks 无法通过它。分支/修订 如果存储库有多个分支,AWS OpsWorks 默认下载主分支。要指定特定分支,请输入分支名称、SHA1 哈希或标记名称。要指定特定提交,请输入完整的 40 位十六进制提交 ID。

于 2014-08-07T03:09:12.387 回答