6
5

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.

Macを再起動したらSourceTreeでpermissionエラーになるときの解決方法

Posted at

起こったこと

SourceTreeを使ってsshでgitやbitbucketのリポジトリ操作をしていたが、macを再起動したら
「Permission denied (publickey).」
と表示されて、操作ができなくなってしまった。

解決方法

SourceTreeにユーザーを追加した際に ~/.ssh/config に追記された部分を編集した。

  1. Host がgit,bitbucketのユーザー名に基づいて設定されているので、それぞれ「github.com」、「bitbucket.org」に変更
  2. User がgit,bitbucketのユーザー名に基づいて設定されているので、それぞれ「github」、「bitbucket」に変更

スクリーンショット

スクリーンショット 2018-10-31 13.47.47.png

スクリーンショット 2018-10-31 13.48.29.png

※コピペ用

~/.ssh/config
# --- Sourcetree Generated ---
Host github.com
    HostName github.com
    User git
    PreferredAuthentications publickey
    IdentityFile /Users/macのユーザー名/.ssh/gitのユーザー名-GitHub
    UseKeychain yes
    AddKeysToAgent yes
# ----------------------------

# --- Sourcetree Generated ---
Host bitbucket.org
    HostName bitbucket.org
    User bitbucket
    PreferredAuthentications publickey
    IdentityFile /Users/macのユーザー名/.ssh/bitbucketのユーザー名-Bitbucket
    UseKeychain yes
    AddKeysToAgent yes
# ----------------------------

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?