diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2025-01-03 04:26:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-02 20:26:48 +0000 |
commit | e709cc76da6b6136d3134c0c702eb7e8f98abce2 (patch) | |
tree | bb12c5c10822ba43c0582b712ffdec9b55e94686 /modules/git/repo_archive.go | |
parent | 9ac536a904b1ca8362d7fd59fc204662ff52139e (diff) | |
download | gitea-e709cc76da6b6136d3134c0c702eb7e8f98abce2.tar.gz gitea-e709cc76da6b6136d3134c0c702eb7e8f98abce2.zip |
Make Gitea always use its internal config, ignore `/etc/gitconfig` (#33076)
In history, Gitea could use the system config `/etc/gitconfig` because
some users said that "they might put certNonceSeed in it"
Actually, we shouldn't not use it, because it also causes conflicts
(there are already some fixes like #28848)
To make the system clear, I think it's worth to introduce the breaking
change: add `GIT_CONFIG_NOSYSTEM=1` to all git commands.
## :warning: BREAKING :warning:
For most users, nothing need to do.
If you have made changes to `/etc/gitconfig` to affect Gitea's behavior,
you need to move these config options to Gitea's internal git config
file, it is usually in Gitea's `{AppDataPath}/home/.git` directory.
Diffstat (limited to 'modules/git/repo_archive.go')
-rw-r--r-- | modules/git/repo_archive.go | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/modules/git/repo_archive.go b/modules/git/repo_archive.go index 1bf1aa41b9..2b45a50f19 100644 --- a/modules/git/repo_archive.go +++ b/modules/git/repo_archive.go @@ -8,7 +8,6 @@ import ( "context" "fmt" "io" - "os" "path/filepath" "strings" ) @@ -63,15 +62,11 @@ func (repo *Repository) CreateArchive(ctx context.Context, format ArchiveType, t cmd.AddOptionFormat("--format=%s", format.String()) cmd.AddDynamicArguments(commitID) - // Avoid LFS hooks getting installed because of /etc/gitconfig, which can break pull requests. - env := append(os.Environ(), "GIT_CONFIG_NOSYSTEM=1") - var stderr strings.Builder err := cmd.Run(&RunOpts{ Dir: repo.Path, Stdout: target, Stderr: &stderr, - Env: env, }) if err != nil { return ConcatenateError(err, stderr.String()) |