Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitconfig: set safe.directory = * #19870

Merged
merged 9 commits into from
Jun 17, 2022
13 changes: 13 additions & 0 deletions modules/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ func syncGitConfig() (err error) {
}
}

// Disable the security check because Gitea runs the git CLI from within the
// repository. See https://github.com/go-gitea/gitea/issues/19455 for the full discussion.
// safe.directory accept * was introduced in https://github.com/git/git/blob/main/Documentation/RelNotes/2.30.4.txt
zeripath marked this conversation as resolved.
Show resolved Hide resolved
if CheckGitVersionAtLeast("2.30.4") == nil {
if err := configAddNonExist("safe.directory", "*"); err != nil {
return err
}
} else {
if err := configSet("safe.directory", setting.RepoRootPath); err != nil {
return err
}
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
}

zeripath marked this conversation as resolved.
Show resolved Hide resolved
if runtime.GOOS == "windows" {
if err := configSet("core.longpaths", "true"); err != nil {
return err
Expand Down