Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git Docker中的编写器未通过私有回购的验证_Git_Docker_Ssl_Ssh_Composer Php - Fatal编程技术网

Git Docker中的编写器未通过私有回购的验证

Git Docker中的编写器未通过私有回购的验证,git,docker,ssl,ssh,composer-php,Git,Docker,Ssl,Ssh,Composer Php,我有一个Docker容器,它正在生成一个在私有回购中具有依赖关系的项目 Dockerfile正在复制我的无密码SSH密钥(权限为600&644): 复制后,将安装Composer依赖项: RUN echo *** >> /etc/hosts \ && composer config -a -g *URL *USER *PASS \ && composer install --prefer-dist --no-progress 同时,我删除了c

我有一个Docker容器,它正在生成一个在私有回购中具有依赖关系的项目

Dockerfile
正在复制我的无密码SSH密钥(权限为
600
&
644
):

复制后,将安装Composer依赖项:

RUN echo *** >> /etc/hosts \
  && composer config -a -g *URL *USER *PASS \
  && composer install --prefer-dist --no-progress
同时,我删除了
composer.lock
,以确保以前的安装没有留下任何内容

composer中的存储库部分如下所示:

"repositories": [
    {
        "type": "vcs",
        "url": "git@***:***/libs/***.git",
        "options": {
            "ssl": {
                "local_cert": "~/.ssh/id_rsa.pub"
            }
        }
    },
],
在创建容器的过程中,我收到了一个错误消息:

[RuntimeException]
Failed to execute git clone --mirror 'git@***:***/libs/***.git' '/root/.composer/cache/vcs/.../'
Cloning into bare repository '/root/.composer/cache/vcs/...'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
存储库确实存在,SSH密钥是有效的,而且最奇怪的是……如果我省略
composer install
命令并输入创建的容器,不做任何更改并从终端手动执行,它将安装所有内容

编辑:

如果在容器创建过程中密钥不可用,我也尝试手动在
RUN
命令中写入密钥,但这没有帮助


我还尝试从Composer中删除了
“选项”
部分在
运行
命令中缺少以下部分:

echo "xxx.xxx.xxx.xxx my_server_name" >> /etc/hosts

ssh-keyscan -t rsa my_server_name >> ~/.ssh/known_hosts 

完成后,我可以从Composer中完全省略
“options”
部分缺少的是
RUN
命令中的以下部分:

echo "xxx.xxx.xxx.xxx my_server_name" >> /etc/hosts

ssh-keyscan -t rsa my_server_name >> ~/.ssh/known_hosts 

完成后,我可以从Composer中完全省略
“options”
部分

如何生成
id\u rsa.pem
?您只复制了
id\u rsa
id\u rsa.pub
对不起,它应该是
id\u rsa.pub
。它是用ssh-keygen生成的。两者都是复制的
id\u rsa.pem
是如何生成的?您只复制了
id\u rsa
id\u rsa.pub
对不起,它应该是
id\u rsa.pub
。它是用ssh-keygen生成的。两者都是复制品