代码之家  ›  专栏  ›  技术社区  ›  Jaime Montoya

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

  •  0
  • Jaime Montoya  · 技术社区  · 6 年前

    我正在尝试使用 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 回复  |  直到 6 年前
        1
  •  1
  •   Jaime Montoya    6 年前

    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签出[分支名称] 同样,这次我可以成功地切换分支。