【问题标题】:Docker container cannot clone public Github repoDocker 容器无法克隆公共 Github 存储库
【发布时间】:2016-11-23 06:25:17
【问题描述】:

我猜这是一个互联网连接问题,但是,可能缺少一些 RSA 公钥。

我有这个 Dockerfile:

FROM node:4-onbuild
COPY test-install-post-publish.sh /usr/src/app/
EXPOSE 8888

复制到容器中的 bash 脚本如下所示:

#!/usr/bin/env bash

cd # cd to home dir
mkdir suman-test
cd suman-test &&
rm -rf suman-test-projects &&
git clone git@github.com:sumanjs/suman-test-projects.git &&
cd suman-test-projects &&
./test-all.sh

我运行容器,我得到了这个:

npm info it worked if it ends with ok
npm info using npm@2.15.11
npm info using node@v4.6.2
npm info prestart installation@1.0.0
npm info start installation@1.0.0

> installation@1.0.0 start /usr/src/app
> ./test-install-post-publish2.sh

Cloning into 'suman-test-projects'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) 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.

npm info installation@1.0.0 Failed to exec start script
npm ERR! Linux 4.4.27-boot2docker
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.6.2
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! installation@1.0.0 start: `./test-install-post-publish2.sh`
npm ERR! Exit status 128
npm ERR! 
npm ERR! Failed at the installation@1.0.0 start script './test-install-post-publish2.sh'.
npm ERR! This is most likely a problem with the installation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./test-install-post-publish2.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs installation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls installation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log

所以看起来容器可以“连接到互联网”,但它很糟糕,因为它没有所需的 RSA 信息。 但是这是一个公共回购!为什么 Github 要求提供 SSH 密钥和东西?

有人知道会发生什么吗?怎么修?我确定这是一个公开的 Github 存储库,如果您愿意,可以自己查看。

【问题讨论】:

  • 也许我应该只使用 HTTPS 而不是 SSH ?但是,为什么上面呢?以及如何解决。

标签: node.js bash github docker dockerfile


【解决方案1】:

也许我应该只使用 HTTPS 而不是 SSH ?

是的,如果您没有添加 ssh 密钥。

但是,为什么是上面的?

您需要将您的公钥添加到 GitHub 以便通过 SSH 进行克隆——即使它是一个公共存储库。为什么?因为 git 需要通过 SSH 对 GitHub 的服务器进行身份验证才能进行克隆。为此,他们需要拥有您的公钥。

【讨论】:

  • “因为 git 需要通过 SSH 对 GitHub 的服务器进行身份验证才能进行克隆。”公开回购?我同意这可能是正在发生的事情,但 SSH 应该对公共存储库“禁用”,而仅对私有存储库启用。
  • @AlexanderMills 也许,这就是 Github 的工作方式。我假设如果他们为公共存储库打开 ssh 身份验证,则允许 DDoS 攻击向量。
猜你喜欢
  • 2016-10-09
  • 1970-01-01
  • 2023-01-11
  • 1970-01-01
  • 1970-01-01
  • 2021-12-31
  • 1970-01-01
  • 2017-06-10
  • 2019-10-22
相关资源
最近更新 更多