Access denied writing to VS project .suo when trying to merge branches with TFS & GIT

I am trying to merge a branch with the master. Branch structure:


My important changes are in v0.43. After making a commit in v0.43 I attempt to merge v0.43 to master. I receive the following error:

  • git list ignored cases
  • How might one “git describe” every commit?
  • Can I modify git-add's hunk size?
  • Tagging versions in github repository
  • msysgit git-am can't apply it's own git format-patch sequence
  • Resolve rebase conflicts easily
  • An error occurred. Detailed message: An error was raised by libgit2.
    Category = Invalid (Error). Could not open
    ‘C:/Users/Me/Source/Repos/MyüProject XXX/MyüProject XXX/XXX XXX
    X.v12.suo’ for writing: Access is denied.

    There is no additional information in the Output pane.

    I also get the above error message when simply trying to change from the v0.43 branch to the master branch. Basically, I’m stuck in the v0.43 branch.

    Please note that the “X”s obscure alpha characters in the actual project name. Are the spaces valid? Is ü valid? If the folder and file names are valid, and the special character is valid, why is Access Denied? Or should the merge need to access this file at all?

    I understand it is a Visual Studio User Settings file. I am fairly sure it is not included in the GIT repository – though I have only checked with:

    git ls-files *.suo

    No files are returned.

    Does this problem have anything to do with a conflict in credentials between TFS/GIT and settings in Visual Studio or Windows? Btw, I am running VS 2013.2 on Win 8.1.

    I can’t determine if the GIT branch merge really needs access to the VS User Settings file (.suo) or if this file shouldn’t even need to be accessed. If it does require access, what could I try to make that happen? If this access isn’t needed at all, why does it keep trying?

    EDIT – Additional Info

    I’m new to TFS/GIT. It’s a lot to absorb. When I initially setup the repositories (local and TFS on the default .gitignore did not get created for some reason, apparently in my local repository? I don’t know, but while I was making changes to my project and then making Commits I was seeing things showing up in “Excluded” and “Untracked”. Being green to GIT/TFS, I right clicked and included these Excluded/Untracked files. I now know this was wrong.

    I think I’ve recovered from the above problem. First, I implemented a default .gitignore that specifically ignores /bin and /obj. Then I removed everything within those two folders (via VS Solution Explorer). They did not come back up as Included, Excluded or Untracked. This fixed one issue.

    Next issue was that I saw the project’s .suo included in the v0.43 branch. I saw that it was supposed to be ignored in the default .gitignore (*.suo) and so I needed to remove it from the v0.43 branch, but it wasn’t as easy as deleting unused files. I did it from the command line using:

    I was able to see that the .suo existed using:

    git ls-files *.suo

    I removed it with:

    git rm --cached "*.suo"
    git commit -m "Delete *.suo file from repository"

    … and I was/am able to confirm it was removed by performing the same ls-files command. It no longer shows up in the v0.43 branch. I made the commit and sync’d with TFS. Now I am getting the error noted above – Access is Denied to the .suo whenever I try to merge v0.43 to master or even switch to master branch.

    Possibly it is the master branch that I am trying to switch TO that is trying to access the .suo file?

    If that’s the case, I’m totally stumped on how to resolve this. I suppose it is possible that the .suo got Committed to the master branch at some point… but I don’t know how to safely access the master branch and remove the .suo from it like I did to v0.43 branch.

    I hope this all makes sense. :S

  • Managing Android project using Git and Eclipse
  • How to connect github with visual studio code?
  • What parameters are showing undefined in this dnvm.ps1 command? Deployment to Azure Web Site Fails as a result
  • Unable to resolve reference refs /refs/remotes/origin/branch while pushing after merging branches
  • Can we use git-cvs on windows?
  • git push --atomic - Not failing
  • 3 Solutions collect form web for “Access denied writing to VS project .suo when trying to merge branches with TFS & GIT”

    I got a very similar issue today. I couldn’t switch branches because there was this error:

    An error occurred. Detailed message: Could not open ‘D:/Projects/ProjectName/Database/database.db’ for writing: Access is denied.

    Note: Pathname and filename renamed for display purposes

    What I did was very simple

    • Remove the file from your file explorer (not in your project)
    • Git will now detect a deletion of this file
    • Undo this deletion in your Changes view

    I’m not sure what caused this problem and I hope anyone finds this answer helpful.

    I’m working on this right now and believe this to be the answer to the problem-
    The *.sou file is part of Visual Studio’s user preferences. It’s in the “.vs” folder that is a “hidden folder” along side your solution.

    If you are using Team Services as your Git repository, then you just need to remove the “.vs” folder and it will be marked “Deleted/{folder}/.vs”

    To delete the folder in Team Services: locate the project in Team Services, and hover over the “Code” drop down menu and select “Files”. Navigate to the .sln folder and you will find the “.vs” folder. Delete that “.vs” folder by “righ-clicking” on it and selecting “Delete”

    That folder should no longer be tracked.

    I also get this situation sometime but there is a simple solution for this.

    Just delete the .suo file from your project folder

    • goto solution explorer and right click on solution and choose second last option named ‘open folder in file explorer’.

      enter image description here

    • After that goto .vs folder(This is a hidden folder).

    • After that open folder, that has a name of your project.

    • Then delete the .sou file in that folder.

    • It’s done.

    • Open your visual studio and you see your problem is solved.

    Thank you,
    Nishit Zinzuvadiya.

    Git Baby is a git and github fan, let's start git clone.