LoginSignup
12
13

More than 5 years have passed since last update.

SourceTreeでGitリポジトリに急にpullやfetchができなくなった時の対処

Last updated at Posted at 2017-05-12

結論から先に

原因はいくつかあるが、たいていは下記2つのうちのどちらか。

原因その1

  • 原因:Bitbucketにログインしていない
  • 対処:WEBブラウザでBitbucketにログインすると直る

原因その2

  • 原因:SourceTreeが ~/.ssh/config に自動で書き込んでいるHostが間違えてる
  • 対処:Hostをドメイン名(Bitbucketなら bitbucket.org )に変えれば直る
~/.ssh/config
Host bitbucket.org
        HostName bitbucket.org
        User xxxxxxxx
        PreferredAuthentications publickey
        IdentityFile xxxxxxxx
        UseKeychain yes
        AddKeysToAgent yes

状況

  • SourceTreeを使っている
  • BitbucketのGitリポジトリを使っている
  • 急にpullやfetchができなくなった
  • 昨日まではできた
  • terminalから直接 git pull してもダメ

エラー内容

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

Please make sure you have the correct access rights
and the repository exists.

余談

  • 最初はssh鍵がおかしくなっちゃったかなと思ったけど違った
  • リポジトリが消えたわけでもなかった
  • IPv4とかIPv6も関係なかった
12
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
12
13