[Solved] GitHub Action incapable of pushing due to “unsafe repository” error

We Are Going To Discuss About GitHub Action incapable of pushing due to “unsafe repository” error. So lets Start this githib Article.

GitHub Action incapable of pushing due to “unsafe repository” error

  1. [Solved] GitHub Action incapable of pushing due to “unsafe repository” error

    This is happening because of a security vulnerability. The error is thrown inside the docker container before you can execute the git config commands to fix the unsafe repository problem. You need to modify the entrypoint of the docker container to execute the git command. You can check this link for details about the vulnerability.

  2. GitHub Action incapable of pushing due to “unsafe repository” error

    This is happening because of a security vulnerability. The error is thrown inside the docker container before you can execute the git config commands to fix the unsafe repository problem. You need to modify the entrypoint of the docker container to execute the git command. You can check this link for details about the vulnerability.

Solution 1

This is happening because of a security vulnerability. The error is thrown inside the docker container before you can execute the git config commands to fix the unsafe repository problem. You need to modify the entrypoint of the docker container to execute the git command. You can check this link for details about the vulnerability.

A temporary workaround until git/action owners make a change could be to fork/clone the action that uses docker and modify it with something like this.

#!/bin/bash

set -o pipefail

# config
# ...

# Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches
git config --global --add safe.directory /github/workspace
#...

You can take a look at the comments in this issue for some ideas about a workaround.

Original Author dgokcin Of This Content

Solution 2

Windows 10

In my case “Unsafe repository is owned by someone else” resolved by command in mention folder

Use takeown from the command prompt to take ownership a folder, all its subfolders and files recursively.

takeown.exe /f . /r

This works well, but if you don’t run your command line console as administrator it may fail for files you don’t own.

Original Author Ruslan Novikov Of This Content

Solution 3

I added the whole path to the current project:

git config --global --add safe.directory '/home/user/AndroidStudioProjects/MyRepoNameInc'

Then performed the push

git commit -m "first commit"

Original Author Jose Antonio Of This Content

Solution 4

I had this issue with GitLab runner. spent hours doing everything. At last, it started to work after updating .gtlab-ci.yml .

Folder permissions were as below

/var/www/html/project – www-data:www-data

/var/www/html/projcect/.git – gitlab-runner:www-data

Updated script as below.

script:
    - git config --global --add safe.directory /var/www/html/phase-3/public-ui

Original Author Nipun Tharuksha Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment