2016-11-23 128 views
0

我猜這是一個互聯網連接問題,但是,可能有一些RSA公鑰丟失。碼頭集裝箱不能克隆公共Github回購

我有這個Dockerfile:

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

是被COPY'ed進入容器中的bash腳本看起來像:

#!/usr/bin/env bash 

cd # cd to home dir 
mkdir suman-test 
cd suman-test && 
rm -rf suman-test-projects && 
git clone [email protected]:sumanjs/suman-test-projects.git && 
cd suman-test-projects && 
./test-all.sh 

我跑的容器中,我得到這個:

npm info it worked if it ends with ok 
npm info using [email protected] 
npm info using [email protected] 
npm info prestart [email protected] 
npm info start [email protected] 

> [email protected] 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 [email protected] 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! [email protected] start: `./test-install-post-publish2.sh` 
npm ERR! Exit status 128 
npm ERR! 
npm ERR! Failed at the [email protected] 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公共回購,如果你願意,你可以親自看看。

+0

也許我應該只使用HTTPS而不是SSH?但是,爲什麼上面呢?以及如何解決。 –

回答

1

也許我應該只使用HTTPS而不是SSH?

是的,如果你沒有添加ssh密鑰。

但是,爲什麼上面呢?

您需要將您的公鑰添加到GitHub中,以便通過SSH克隆 - 即使它是公共回購。爲什麼?因爲git需要通過SSH對GitHub的服務器進行身份驗證才能完成克隆。爲了做到這一點,他們需要有你的公鑰。

+0

「因爲git需要通過SSH對GitHub的服務器進行身份驗證才能完成克隆。」對於公共回購?我同意這可能是正在發生的事情,但SSH應該被禁用用於公共回購,並且只能用於私人回購。 –

+1

@AlexanderMills也許,這就是Github的工作原理。我假設他們是否打開公共回購的ssh認證,這是允許DDoS攻擊的載體。 –