LoginSignup
12
15

More than 5 years have passed since last update.

githubで"Permission denied (publickey)."が出た時はssh -Tで繋ぎ直す

Last updated at Posted at 2014-10-28

PCを再起動したりした時に、たまにgithubにsshでpullやpushできなくなるときがあります。

$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

その時はssh -T git@(ホスト名)で再度繋ぎ直します。

-Tはsshでの仮想端末接続(pseudo-tty)を無効化するオプション。githubはsshクライアントでの接続をさせるつもりはないので、それで繋がないようにするためにこのオプションをつけます。
ついでに-v(結果を出力)をつけるとよいかもです。

$ ssh -vT git@github.com

当たり前だけどホスト名のところはsshのconfigで設定したHost名でもOKです。

参考
http://stackoverflow.com/questions/17900760/what-is-pseudo-tty-allocation-ssh-and-github

12
15
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
12
15