docker集装箱不能克隆公共Github回购

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

我有这个Dockerfile:

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

获取COPY到容器的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 

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

任何人都知道可能会发生什么? 怎么修? 我确定这是一个公众的Github回购,你可以自己看看,如果你想。

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

是的,如果你没有添加SSH密钥。

但是,为什么上面呢?

您需要将您的公钥添加到GitHub中,以便通过SSH克隆 – 即使它是公共回购。 为什么? 因为git需要通过SSH对GitHub的服务器进行身份validation才能完成克隆。 为了做到这一点,他们需要有你的公钥。