LoginSignup
19
12

More than 5 years have passed since last update.

git pullやgit fetchをしようとしたらエラーが出るとき

Posted at

現象

gitでリモートブランチをチェックアウトしようとしたら下記エラー。

$ git fetch && git checkout mybranch1

error: Unable to append to .git/logs/refs/remotes/origin/mybranch2: ????????
From bitbucket.org:user1/myrepository
! 6aa2ddf..28743b7 mybranch2 -> origin/mybranch2 (unable to update local ref)
error: Unable to append to .git/logs/refs/remotes/origin/mybranch3: ????????
! 9b502e2..5c229bd mybranch3 -> origin/mybranch3 (unable to update local ref)

原因

.git/logs/refs/heads
.git/logs/refs/remotes

ここにあるファイルへの書き込み権限が無い。

対処

.git/logs/refs/heads
.git/logs/refs/remotes

ここのファイルの中で、エラーで名前が挙がっているブランチ名のファイルの権限をchownコマンド等で変更する。
(この場合はmybranch2とmybranch3)

または、権限のあるユーザーになってからgitコマンドを実行する。

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