Home > other >  fatal: unsafe repository is owned by someone else - GitHub actions workflow
fatal: unsafe repository is owned by someone else - GitHub actions workflow

Time:06-02

I have two yml files configured in the GitHub actions. When new code is pushed to master, one yml file deploys the files to specific website folder, and the other one to another website folder. Even though both websites are on the same server, one of the deploy.yml files is not executing jobs and it's throwing this error.

fatal: unsafe repository ('/var/www/yayyy.net/public_html' is owned by someone else)
To add an exception for this directory, call:
    
        git config --global --add safe.directory /var/www/yyyy.net/public_html
    Error: Process completed with exit code 128.

at this step:

- name: Add temp repo access
  run: |
    cd $DEV_WEBSITE_PATH
    git remote set-url origin https://anything:${{ secrets.GITHUB_TOKEN }}@github.com/yyyyy/website.git

I tried adding extra step before that step and added this safe.directory command but then it's showing permission denied error.

error: could not lock config file /var/www/.gitconfig: Permission denied

Adding sudo before the command then throws this error:

sudo: sorry, you must have a tty to run sudo

I'm confused what I'm missing, can you help?

CodePudding user response:

The.gitconfig did not exist and the username didn't have permission to create it. So, I created it manually and changed ownership to the username.

  • Related