ghpages icon indicating copy to clipboard operation
ghpages copied to clipboard

Fix for git version >=2.35.2: Add the current dir as a git safe dir

Open bryant1410 opened this issue 3 years ago • 4 comments
trafficstars

From git 2.35.2, the repository needs to be owned by the current user. See https://github.blog/2022-04-12-git-security-vulnerability-announced/

This occurs because this runs inside Docker with a root user, while the directory is owned by another user (1001 in my case).

Without this, after doing git init, any git command on the repo can either output:

fatal: not in a git directory

or:

fatal: unsafe repository

bryant1410 avatar May 31 '22 12:05 bryant1410

+1, I am currently affected (failed build), thanks @bryant1410 for the fix.

Dear maintainer, can you please merge this PR, thanks! @maxheld83

ztl8702 avatar Jun 09 '22 13:06 ztl8702

@bryant1410 I tried using your branch, but got this error instead:

fatal: could not read Password for 'https://***@github.com': No such device or address

build log: https://github.com/zingzeu/yngping-spec/runs/6813352579?check_suite_focus=true

My workflow config: https://github.com/zingzeu/yngping-spec/blob/edb6eb9ebd6237a9254bd80cf13c69e65bf5a95a/.github/workflows/deploy.yml#L25-L30

Do you have any idea what might have been wrong?

ztl8702 avatar Jun 09 '22 13:06 ztl8702

No idea. I'm using my branch in a repo: https://github.com/bryant1410/resume/blob/4b15222/.github/workflows/deploy.yml#L22

bryant1410 avatar Jun 09 '22 14:06 bryant1410

I switched to using https://github.com/marketplace/actions/deploy-to-github-pages instead

ztl8702 avatar Jun 11 '22 06:06 ztl8702