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 开发者_JAVA百科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.
TortoiseGIT process that blocks those files. Open task manager and end process
TGitCache.exe
.
The OP virtuesplea reports:
Killing the TGitCache.exe process (from the other topic) ended up being the solution
The main problem here is that the editor/IDE is locking the file/folders. When you close the editor/ide, the file/folder will disappear and you can change branches/merge/rebase.
Different branches might contain different folders, so when branches are changed/merged/rebased, the editor/ide reloads the file system.
Maybe you did not allow the editor/ide to perform this reload or some settings are there which does not allow this. I encountered a similar problem in visual studio.
To solve this, just close the editor/ide.
精彩评论