1
1

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.

git checkout/switch しようとして、error: cannot stat 'xx/yy/zz': Permission denied エラーが出た時の対処法

Posted at

ある日…

Gitを使ってブランチAで開発をしていて、他の人が作業しているブランチBに移動し、確認だけして自分のブランチAに戻ろうとしました。

ブランチBでの確認作業を終え、

git switch ブランチA

とした私は

error: cannot stat 'xx/yy/zz': Permission denied

というエラーが出てきてブランチAに戻れなくなってしまいました!

ブランチの移動に伴う、ファイルの変更・削除ができないときにこのエラーが出るようです。

解決方法

'xx/yy/zz'のディレクトリ階層のファイルをテキストエディタなどで開いていれば、それを全て閉じましょう。
再度 checkout / switch でブランチ移動できるはずです。

私は体験していませんが、

error: cannot stat 'xx/yy/zz': Protocol error

の場合でも、同様の対処方法で解決できそうです。

参考にしたサイト

https://codeday.me/jp/qa/20190713/1250687.html
https://teratail.com/questions/60939
https://codeday.me/jp/qa/20190429/732351.html

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?