gitvisual-studioazuregithubmicrosoft-web-deploy

Make Git ignore PublishProfile for WebDeploy in Visual Studio


I host ASP.NET MVC app on Azure so I use WebDeploy. There is a folder with my Publish Profile which include AppName Web Deploy.pubxml which include password for db. So if I pushed changes to Github everyone would be able to see my db password.

I use Git extension for Visual Studio and I want to "untrack" this folder. How can I do this?


Solution

  • If as a general rule, you would like to ignore the publish profiles from being committed, then add the following lines to the .gitignore file of your solution

    *.[Pp]ublish.xml
    *.azurePubxml
    *.pubxml
    *.publishproj
    

    On the other hand, it may be worthwhile to spend some time removing database config from publish profile by using Web Deploy Parameters and setting up a small release cycle to avoid publishing directly from VS.