cap stage deployを実行するとエラーになる
[git][* hoge-hoge-hoge]:~/projects/hoge/ bundle exec cap stage deploy 00:00 git:wrapper 01 mkdir -p /tmp/hoge/ ✔ 01 deployer@hoge.poge.me 0.226s Uploading /tmp/hoge/git-ssh.sh 100.0% 02 chmod +rx /tmp/hoge/git-ssh.sh ✔ 02 deployer@hoge.poge.me 0.025s 00:00 git:check 01 git ls-remote --heads git@github.com:poge/hoge.git 01 Permission denied (publickey). 01 fatal: Could not read from remote repository. 01 01 Please make sure you have the correct access rights 01 and the repository exists. (Backtrace restricted to imported tasks) cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as deployer@hoge.poge.me: git exit status: 128 git stdout: Nothing written git stderr: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. SSHKit::Command::Failed: git exit status: 128 git stdout: Nothing written git stderr: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Tasks: TOP => git:check (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as deployer@hoge.poge.me: git exit status: 128 git stdout: Nothing written git stderr: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ** DEPLOY FAILED ** Refer to log/capistrano.log for details. Here are the last 20 lines: Please make sure you have the correct access rights and the repository exists. INFO --------------------------------------------------------------------------- INFO START 2016-08-24 19:39:34 +0900 cap stage deploy INFO --------------------------------------------------------------------------- INFO [90de94b6] Running /usr/bin/env mkdir -p /tmp/hoge/ as deployer@hoge.poge.me DEBUG [90de94b6] Command: /usr/bin/env mkdir -p /tmp/hoge/ INFO [90de94b6] Finished in 0.226 seconds with exit status 0 (successful). DEBUG Uploading /tmp/hoge/git-ssh.sh 0.0% INFO Uploading /tmp/hoge/git-ssh.sh 100.0% INFO [6247b79d] Running /usr/bin/env chmod +rx /tmp/hoge/git-ssh.sh as deployer@hoge.poge.me DEBUG [6247b79d] Command: /usr/bin/env chmod +rx /tmp/hoge/git-ssh.sh INFO [6247b79d] Finished in 0.025 seconds with exit status 0 (successful). INFO [a7f4afba] Running /usr/bin/env git ls-remote --heads git@github.com:poge/hoge.git as deployer@hoge.poge.me DEBUG [a7f4afba] Command: ( export GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/hoge/git-ssh.sh" ; /usr/bin/env git ls-remote --heads git@github.com:poge/hoge.git ) DEBUG [a7f4afba] Permission denied (publickey). DEBUG [a7f4afba] fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
エラー解消方法 公開鍵をssh-addする
ssh-add -l The agent has no identities. ssh-add ~/.ssh/id_rsa Identity added: /Users/hoge/.ssh/id_rsa (/Users/hoge/.ssh/id_rsa) ssh-add -l 2048 23i4u2oi:5c:21:da:23423498:be:00:58:629387:cd:12:18:18:7c:14 /Users/hoge/.ssh/id_rsa (RSA) #永続的にaddする方法 ssh-add -K ~/.ssh/id_git_rsa