25
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

capistranoでいきなりgithubに繋がらなくなった時の話

Last updated at Posted at 2018-05-20

###PCを再起動したらいきなり次のような感じでcapistranoでdeployできなくなった。

00:00 git:check
      01 git ls-remote git@github.com:アカウント名/アプリ名.git HEAD
      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 on host IPアドレス: git exit status: 128
git stdout: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
git stderr: Nothing written

###いろいろ試した結果、次をlocalの自分のアプリのディレクトリで実行したらうまく行った。

ssh-add ~/.ssh/id_rsa   <ーこの鍵はGithubのssh接続で使ってるやつ

でもなんでいきなり繋がらなくなったんだろう。。。

最初っから繋がらないよ〜てひとはconfig/deploy.rbの以下の部分とかを確認してみてください。

server '自分のサーバーのIPアドレス', port: 22, roles: [:app, :web, :db], primary:true
set :repo_url, "git@github.com:アカウント名/アプリ名.git"
set :application, "アプリ名"
set :user, 'デプロイに使うユーザ名'
set :ssh_options, {
  forward_agent: true,
  user: fetch(:user),
  keys: %w(~/.ssh/デプロイユーザのSSH接続に使っている鍵)
}

####参考
1.Capistranoによるデプロイで発生したgithub接続エラーを解決する

2.Githubのsshで何故かPermission denied (publickey)となる場合の設定メモ

25
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?