git rebase: “error: cannot stat 'file': Permission denied”

后端 未结 30 2302
野趣味
野趣味 2020-12-02 04:56

I\'m using git, and made a small commit followed by a large one. I decided to use git rebase to squash the two commits together before pushing them. (I\'ve ne

相关标签:
30条回答
  • 2020-12-02 05:17

    I just ran into this issue. Non of the answers here happened to solve this for me.

    Ended up being nuget packages I added on a branch that, once switched back to master branch, seemed to not exist. Once I did a merge it would say newtonsoft...xml could not stat. I would go to the file in question and open it but Windows threw an error back saying it can't find the file (even though I was looking right at it)

    How I solved this was right click delete the file (which worked but I couldnt open it because windows couldnt find it???) and try to merge again and it solved the problem.

    Very strange.

    Hope this helps someone later.

    0 讨论(0)
  • 2020-12-02 05:18

    If the IDE you use(in case you use one) might have been getting in the way as well. That's what happened to me when using QtCreator.

    0 讨论(0)
  • 2020-12-02 05:19

    if using vscode, kill terminal and open new one. else maybe close terminal too

    0 讨论(0)
  • 2020-12-02 05:19

    I agree with the above "Close Visual Studio" answers.

    However, an additional step I had to do even after I'd closed Visual Studio was to manually kill the "devenv.exe" Visual Studio process in Task Explorer. After I had done this I was able to again run in gitbash:

    git pull

    and the "cannot stat filename" error disappeared. It is perhaps due to a Visual Studio extension keeping the process open for longer even after closing.

    0 讨论(0)
  • 2020-12-02 05:20

    Using SourceTree in Win 10, fixed the problem by closing Atom editor.

    Error reproduce:

    1. In branch B, create a md file, using Atom edit it, save and commit.
    2. Switch to branch A, pull down new commits from server.
    3. Try Switch back, Opps, it says “error: cannot stat 'file': Permission denied”.
    0 讨论(0)
  • 2020-12-02 05:20

    My encounter with this problem was caused by my editor, Intellij. As part of its internal version controls, it had gone through and locked all hidden git files. (For various reasons, I was not using the git plugin that comes with Intellij...)

    So I opened a normal dos window as Administrator, changed to the directory, and executed

    attrib -R /S
    

    That removed the lock on the files and everything worked after that and I could sync my changes using the GitHub windows client.

    0 讨论(0)
提交回复
热议问题