Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.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
Bash SSH访问代码传递上的github repo_Bash_Git_Docker_Ssh_Codeship - Fatal编程技术网

Bash SSH访问代码传递上的github repo

Bash SSH访问代码传递上的github repo,bash,git,docker,ssh,codeship,Bash,Git,Docker,Ssh,Codeship,我试图从Codeship上的容器推送到github。在获得一个权限被拒绝(publickey)错误后,我遵循了以下建议: 我创建了一个名为publishto的服务,并通过一些步骤尝试重新创建文章的建议 My codeship_services.yml文件: # codeship_services.yml publish: build: image: codeship/setting-ssh-key-test dockerfile: Dockerfile.publish

我试图从Codeship上的容器推送到github。在获得一个
权限被拒绝(publickey)
错误后,我遵循了以下建议:

我创建了一个名为publishto的服务,并通过一些步骤尝试重新创建文章的建议

My codeship_services.yml文件:

# codeship_services.yml
publish:
  build: 
    image: codeship/setting-ssh-key-test
    dockerfile: Dockerfile.publish
  encrypted_env_file: codeship.env.encrypted
  volumes:
    - ./.ssh:/root/.ssh
- name: temp publish service
  service: publish
  command: /bin/bash -c "echo -e $PRIVATE_SSH_KEY >> /root/.ssh/id_rsa"

- name: chmod id_rsa
  service: publish
  command: chmod 600 /root/.ssh/id_rsa

- name: add server to list of known hosts
  service: publish
  command: /bin/bash -c "ssh-keyscan -H github.com >> /root/.ssh/known_hosts"

- name: confirm ssh connection to server, authenticating with generated public ssh key
  service: publish
  command: /bin/bash -c "ssh -T git@github.com"

My codeship_steps.yml文件:

# codeship_services.yml
publish:
  build: 
    image: codeship/setting-ssh-key-test
    dockerfile: Dockerfile.publish
  encrypted_env_file: codeship.env.encrypted
  volumes:
    - ./.ssh:/root/.ssh
- name: temp publish service
  service: publish
  command: /bin/bash -c "echo -e $PRIVATE_SSH_KEY >> /root/.ssh/id_rsa"

- name: chmod id_rsa
  service: publish
  command: chmod 600 /root/.ssh/id_rsa

- name: add server to list of known hosts
  service: publish
  command: /bin/bash -c "ssh-keyscan -H github.com >> /root/.ssh/known_hosts"

- name: confirm ssh connection to server, authenticating with generated public ssh key
  service: publish
  command: /bin/bash -c "ssh -T git@github.com"

但是,在运行
jet步骤时,
权限被拒绝(公钥)
错误:

(step: temp_publish_service) success ✔
(step: chmod_id_rsa) 
(step: chmod_id_rsa) success ✔
(step: add_server_to_list_of_known_hosts) 
(service: publish) (step: add_server_to_list_of_known_hosts) # github.com:22 SSH-2.0-babeld-80573d3e
(service: publish) (step: add_server_to_list_of_known_hosts) # github.com:22 SSH-2.0-babeld-80573d3e
(service: publish) (step: add_server_to_list_of_known_hosts) # github.com:22 SSH-2.0-babeld-80573d3e
(step: add_server_to_list_of_known_hosts) success ✔
(step: confirm_ssh_connection_to_server,_authenticating_with_generated_public_ssh_key) 
(service: publish) (step: confirm_ssh_connection_to_server,_authenticating_with_generated_public_ssh_key) Permission denied (publickey).
(step: confirm_ssh_connection_to_server,_authenticating_with_generated_public_ssh_key) error ✗
(step: confirm_ssh_connection_to_server,_authenticating_with_generated_public_ssh_key) container exited with a 255 code
我已经按照文章中的说明生成了密钥,并将加密的私钥添加到
codeship.env.encryped


我缺少什么吗?

唯一缺少的步骤是注册

只有这样,使用相同公钥的SSH连接才有机会成功


如果没有,请至少尝试
ssh-Tvvgit@github.com
在最后一步中,为了获得更多线索。

谢谢@VonC!如果此回购协议是组织的一部分,则密钥是否在“部署密钥”下?我在组织的repo上看不到ssh密钥的位置。@泰勒:只要你的GitHub帐户是组织的一部分,你自己的帐户就足够了。