尝试切换分支时出现“权限被拒绝”错误

时间:2018-11-26 14:17:11

标签: git permissions branch file-permissions git-reset

我正在尝试使用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

之前,一切正常,我突然开始遇到上述问题。我只是想切换分支。您建议尝试什么?

1 个答案:

答案 0 :(得分:0)

很奇怪。我再次尝试def search @student = Student.search(params[:search]) if @student.present? flash[:notice] = 'Student is available,Please create' redirect_to :action => :new end if @student.nil? @studentId=params[:search] //Not working # @studentId="123"//working end end ,这次是我看到的他的错误:

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 ,这次我可以成功切换分支。