Я пытаюсь развернуть свое приложение rails на сервере с помощью Capistrano.
В моем локальном компьютере я запустил «cap production deploy», после чего возникли ошибки.
12: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `run'
11: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
10: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/capistrano-3.11.2/lib/capistrano/scm/tasks/git.rake:18:in `block (3 levels) in eval_rakefile'
9: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:100:in `with'
8: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/capistrano-3.11.2/lib/capistrano/scm/tasks/git.rake:19:in `block (4 levels) in eval_rakefile'
7: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/capistrano-3.11.2/lib/capistrano/scm/git.rb:38:in `check_repo_is_reachable'
6: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/capistrano-3.11.2/lib/capistrano/scm/git.rb:77:in `git'
5: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:80:in `execute'
4: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
3: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `tap'
2: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
1: from /Users/rainbowtape/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/Users/-------------/.rvm/gems/ruby-2.6.5/gems/sshkit-1.20.0/lib/sshkit/command.rb:97:in `exit_status=': git exit status: 128 (SSHKit::Command::Failed)
git stdout: Nothing written
git stderr: [email protected]: Permission denied (publickey).
Поэтому я пошел проверить на стороне сервера, может ли сервер общаться с Github. Это настроилось, это не так.
[email protected]:~$ ssh -vT [email protected]
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Deprecated option "useroaming"
debug1: Connecting to github.com [140.82.118.4] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deploy/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version babeld-2e9d163d
debug1: no match: babeld-2e9d163d
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/deploy/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/deploy/.ssh/id_rsa
debug1: Trying private key: /home/deploy/.ssh/id_dsa
debug1: Trying private key: /home/deploy/.ssh/id_ecdsa
debug1: Trying private key: /home/deploy/.ssh/id_ed25519
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).
Обратите внимание, что я уже скопировал свой локальный открытый ключ на сервер, используя «ssh-copy-id».
[email protected]:~/.ssh$ ls -la
total 16
drwx------ 2 deploy deploy 4096 Nov 27 01:55 .
drwxr-xr-x 10 deploy deploy 4096 Nov 27 05:18 ..
-rw------- 1 deploy deploy 3724 Nov 27 12:37 authorized_keys
-rw-r--r-- 1 deploy deploy 1326 Nov 27 01:57 known_hosts
также я пытался добавить ключи в ssh-agent. но терпит неудачу.
[email protected]:~/.ssh$ eval "$(ssh-agent -s)"
Agent pid 4417
[email protected]:~/.ssh$ ssh-add ~/.ssh/authorized_keys
Error loading key "/home/deploy/.ssh/authorized_keys": invalid format
На стороне сервера будет только мой открытый ключ. правильно? не закрытый ключ. я на правильном пути?
ОБНОВЛЕНИЕ 1
С @ZedTuX
предложить,
Я сгенерировал еще один набор ssh-ключей на стороне сервера. и добавил открытый ключ в репозиторий github, чтобы он мог читать/записывать. поэтому я протестировал git pull и push на стороне сервера. оно работает. бит все еще получает эту ошибку. когда я пытаюсь развернуть в моем локальном.
DEBUG [1b7b3349] error: could not lock config file config: Permission denied
DEBUG [1b7b3349] fatal: could not set 'remote.origin.url' to '[email protected]:maskeduser1/repo1.git'
Для меня это не имеет смысла, так как я могу даже --set-upstream
на Github. Почему я получаю эту ошибку?