繁体   English   中英

AWS SSO、Codecommit(GRC git 克隆链接)和 npm 安装

[英]AWS SSO, Codecommit (GRC git clone link) and npm install

单点登录 (SSO) 在 AWS 账户上实施。 运行aws sso login后,使用(GRC 链接)克隆一个节点是可行的。 但是,在 repo 中运行npm install会导致不同的错误。

前任。 package.json

...
"dependencies": {
    ...
    "common-resource-1": "git+https://git-codecommit.us-east-1.amazonaws.com/v1/repos/common-resource-1#develop",
   ...
}
...

错误

npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t https://git-codecommit.us-east-1.amazonaws.com/v1/repos/common-resource-1
npm ERR!
npm ERR! some-user@git-codecommit.us-east-1.amazonaws.com : Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

这是有道理的,因为没有 ssh 或 https 信用。 git-remote-codecommit python package is installed as recommended buy AWS https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html

但是,以下返回 repo 信息: /usr/local/bin/git ls-remote -h -t codecommit://common-resource-1

还尝试将以下内容放入 package.json "common-resource-2": "codecommit::east-1://common-resource-2#develop" ,我得到的错误是

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "codecommit:": codecommit::east-1://common-resource-2#develop

这是许多存储库的问题,因为其他存储库使用common-resource-1common-resource-2存储库。

对此的任何帮助将不胜感激。

NPM CLI 自定义协议

我在这里发布了这个答案,但应该有一个更强大的更好的答案。

对于 npm-cli(与在命令行上使用 npm 时运行的内容相同)在文件 node_modules/npm-package-arg/npa.js 的第 232 行附近,添加另一个 case 语句,例如:

案例'git + codecommit:':

就是这样。

不过这里有一个问题。 GRC 还链接用户 codecommit::us-east-1: 协议,其中:: 之后是 codecommit 和 repo 所在的区域。

case 语句的当前使用不适用于 codecommit::us-east-1: 之类的内容。 因此,为了使其更健壮,需要更好地解析依赖项中的“url”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM