I’m having trouble merging a branch back to the trunk after adding a new directory.
I created a new branch BUG_BRANCH, made a few code changes, added a directory, and added several files to that directory. I used “git add .” to add my changes for committing to my local branch. Then “git commit -am ‘message here'”. I then pushed my branch up to GitHub “git push origin BUG_BRANCH”, checked out the main development branch again “git checkout dev”, and grabbed any changes that had happened since I’d created my branch “git pull origin dev”.
My problem occurred when I tried to merge the changes from my BUG_BRANCH to dev “git merge BUG_BRANCH”. For each file within the newly created directory, I got “error: cannot stat ‘path’: Permission denied”. When I log into GitHub, I see my changes hanging out in the remote copy of my branch. But I can’t merge them into dev, and I can’t even seem to get back to BUG_BRANCH locally; I get the same error message.
Looking around on StackOverflow, it seems that I could have added the directory using the -A option of add if I could get back to my branch. But I can’t. Any ideas?
As mentioned in “git rebase:
error: cannot stat 'file': Permission denied“, this should be an error seen mainly on Windows.It is usually related to files locked by a Windows process, either an anti-Virus or an IDE (Visual Studio, Eclipse, …).
Make sure no other processes are running when trying to make your checkout or merge, and see if the issue persists.
The OP virtuesplea reports: