website/content/blog/2022-06-23-1.17-breaking-ep...

48 lines
2.5 KiB
Markdown
Raw Normal View History

+++
title = "1.17 breaking changes episode 1: preserving a custom gitconfig"
date = 2022-06-22
description = "The location of the gitconfig file used by Gitea moved and custom modifications must be manually moved as well."
[taxonomies]
tags = ['hostea', 'gitea', 'troubleshoot', 'problem', 'tutorial']
[extra]
author = 'dachary'
+++
Before version 1.17, when Gitea needed to change the [git configuration](https://git-scm.com/docs/git-config), it modified the `$HOME/.gitconfig` file. For instance it would [set core.quotePath to false](https://github.com/go-gitea/gitea/blob/release/v1.16/modules/git/git.go#L174-L177):
```ini
[core]
quotePath = false
```
When installing Gitea [from docker](https://docs.gitea.io/en-us/install-with-docker/) or [rootless](https://docs.gitea.io/en-us/install-with-docker-rootless/) or even [from binary](https://docs.gitea.io/en-us/install-from-binary/) this `$HOME/.gitconfig` file belongs to a user that is [dedicated to Gitea](https://docs.gitea.io/en-us/install-from-binary/#prepare-environment) and not used by anyone else.
However, if an Gitea installation was done differently and `$HOME/.gitconfig` has been customized because it is shared by a user or another application, there is a good chance that manual modifications were done such as:
```ini
[user]
name = Jane Doe
email = jane@doe.com
```
It is also possible that the file was modified manually by the Gitea admin for other reasons. In both there is a **potential for breakage when upgrading to Gitea >= 1.17 because the location of the file changed**. It must be moved manually to the new location as follows:
* Figure out the directory where `$HOME/.gitconfig` must be moved by [running the doctor](https://hostea.org/blog/gentle-introduction-to-the-doctor/):
```shell
$ gitea --work-path /app/gitea -c /data/gitea/conf/app.ini doctor
[1] Check paths and basic configuration
- [I] Configuration File Path: "/data/gitea/conf/app.ini"
- [I] Repository Root Path: "/data/git/repositories"
- [I] Data Root Path: "/data/gitea"
- [I] Custom File Root Path: "/data/gitea"
- [I] Work directory: "/app/gitea"
- [I] Log Root Path: "/data/gitea/log"
OK
```
* Copy the `$HOME/.gitconfig` file to the **Repository Root Path** (which is `/data/git/repositories` in the example above).
The reason why this breaking change was introduced is to workaround [a rare problem](https://hostea.org/blog/unsafe-repository-is-owned-by-someone-else/) impacting Gitea installations relying on networked volumes.