skip to Main Content

I’m working with a ASP.NET application and I deploy using Azure and Git. It’s set to trigger deployment when the Master branch gets pushed to.

I’ve successfully done this in the past but it’s failing now. I can successfully push my code to GitHub where it appears each time, but it fails to deploy on Azure.

From the Deployment Center, I see that the commit id is prefaced with "temp" like "temp-XXXXXX". It also leaves an error message in the log details that says:

"fatal: detected dubious ownership in repository at _______ is owned by: ________ 
but the current owner is _______. 

git config --global --add safe.directory '%(prefix)///____________________'nrnC:Program FilesGitcmdgit.exe 
remote add -t master origin "[email protected]:_____"

(The blanked out info is full IP addresses with subdirectories and repository names, I didn’t think it mattered because this seems like a generic issue)

I tried adding the parent directory to safe.directory using the exact command that they provided, but received an error of "no such file or directory: %(prefix)///_________________.

According to my local file system, I’m already the owner of the directory.

I tried following some of the steps outlined in the answers to this question, but I am reluctant to do git config --global --add safe.directory '*' because it is a shared repository.

Could this issue be caused by Azure itself? Do I need to grant Azure permissions somehow?

Thanks

2

Answers


  1. I recommend using the steps below:-

    Make sure you run this command to add the repository in the safe list like below:-

    git config --global --add safe.directory 'C:Userssid24desaisourcereposWebApplication6'
    

    And then try pushing your code again by adding correct git remote url like below:-

    git remote -v
    
    git remote set-url origin https://github.com/sid24desai/WebApplication6
    

    enter image description here

    enter image description here

    And in order to resolve the error Check this SO thread answer by Stinn and halt9k

    Then I tried deploying a sample .NET application in Azure Web app with .NET 6.0 framework and it got deployed successfully like below:-

    My github action workflow:-

    name: Build and deploy ASP.Net Core app to Azure Web App - valleywebapp832
    
    on:
      push:
        branches:
          - master
      workflow_dispatch:
    
    jobs:
      build:
        runs-on: windows-latest
    
        steps:
          - uses: actions/checkout@v2
    
          - name: Set up .NET Core
            uses: actions/setup-dotnet@v1
            with:
              dotnet-version: '6.0.x'
              include-prerelease: true
    
          - name: Build with dotnet
            run: dotnet build --configuration Release
    
          - name: dotnet publish
            run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
    
          - name: Upload artifact for deployment job
            uses: actions/upload-artifact@v2
            with:
              name: .net-app
              path: ${{env.DOTNET_ROOT}}/myapp
    
      deploy:
        runs-on: windows-latest
        needs: build
        environment:
          name: 'Production'
          url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    
        steps:
          - name: Download artifact from build job
            uses: actions/download-artifact@v2
            with:
              name: .net-app
    
          - name: Deploy to Azure Web App
            id: deploy-to-webapp
            uses: azure/webapps-deploy@v2
            with:
              app-name: 'valleywebapp832'
              slot-name: 'Production'
              publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CD4EC59DD26349C09FBA41C085A9BEBF }}
              package: .
    

    enter image description here

    enter image description here

    Login or Signup to reply.
  2. To provide an update, there was a bug identified. The fix has been rolled out by our product engineering team.
    (tracked on Microsoft Q&A here)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search