"Permission denied" 尝试切换分支时出错
"Permission denied" error when trying to switch branches
我正在尝试使用 git reset --hard
,但出现此错误:
fatal: cannot create directory at '[path]/img/products': Permission denied
我没有更改权限,之前一切正常。然后我尝试 git checkout [branch name]
并得到这个:
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: Your local changes to the following files would be overwritten by checkout:
[path]/img/products/icons.png
[path]/img/products/buttons.png
Please commit your changes or stash them before you switch branches.
error: The following untracked working tree files would be overwritten by checkout:
[path]/img/leftbtn.png
[path]/img/rightbtn.png
[path]/img/logo.png
Please move or remove them before you switch branches.
Aborting
之前一切正常,我突然开始遇到上述问题。我只是想切换分支。您推荐尝试什么?
奇怪。我再次尝试 git checkout [branch name]
,这次我看到的是错误:
error: The following untracked working tree files would be overwritten by checkout:
[path]/img/leftbtn.png
[path]/img/rightbtn.png
[path]/img/logo.png
Please move or remove them before you switch branches.
Aborting
我删除了那些文件,再次尝试git checkout [branch name]
,这次我可以成功切换分支。
我正在尝试使用 git reset --hard
,但出现此错误:
fatal: cannot create directory at '[path]/img/products': Permission denied
我没有更改权限,之前一切正常。然后我尝试 git checkout [branch name]
并得到这个:
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: cannot stat '[path]/img/products': Permission denied
error: Your local changes to the following files would be overwritten by checkout:
[path]/img/products/icons.png
[path]/img/products/buttons.png
Please commit your changes or stash them before you switch branches.
error: The following untracked working tree files would be overwritten by checkout:
[path]/img/leftbtn.png
[path]/img/rightbtn.png
[path]/img/logo.png
Please move or remove them before you switch branches.
Aborting
之前一切正常,我突然开始遇到上述问题。我只是想切换分支。您推荐尝试什么?
奇怪。我再次尝试 git checkout [branch name]
,这次我看到的是错误:
error: The following untracked working tree files would be overwritten by checkout:
[path]/img/leftbtn.png
[path]/img/rightbtn.png
[path]/img/logo.png
Please move or remove them before you switch branches.
Aborting
我删除了那些文件,再次尝试git checkout [branch name]
,这次我可以成功切换分支。