Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase: "error: cannot stat 'file': Permission denied"

Tags:

git

git-rebase

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 never done this before.)

So I did:

git rebase -i HEAD~2

This gave me my editor, where I chose to pick the earlier commit and squash the later one. When I saved, git said:

error: cannot stat 'filename': Permission denied

Could not apply sha1 for later commit... initial line of text for that commit

Now:

  • Neither commit appears when I do git log.
  • git status tells me I'm "Not currently on any branch."
  • One file is listed as modified and in the index, and two files are listed as untracked. My first commit had just one file (I think), and my second commit had a good dozen.

What happened!? How do I fix it?

like image 291
Ryan Lundy Avatar asked May 11 '11 21:05

Ryan Lundy


2 Answers

Try closing any programs that have the folder open, such as editors, explorer windows, command prompts, and FTP programs. This always fixes the issue for me on Windows.

like image 50
Cameron Wright Avatar answered Sep 18 '22 12:09

Cameron Wright


Just close your IDE (VISUAL STUDIO/ATOM etc). It might work

like image 28
ManJan Avatar answered Sep 19 '22 12:09

ManJan