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

2.3 KiB

+++ title = "1.17 breaking changes episode 2: preserving a custom gitconfig" date = 2022-07-20 description = "The location of the gitconfig file used by Gitea moved twice, here is a guide to sort out why and how to deal with it." [taxonomies] tags = ['hostea', 'gitea', 'troubleshoot', 'problem', 'tutorial']

[extra] author = 'dachary' +++

On June 21st, 2022 1.17.0-rc1 was published and the location of the gitconfig file moved to a new location, which required manual intervention. This change impacted a large number of Gitea installations because the docker image tag latest was set to 1.17.0-rc1 by accident. As a result, about 10,000 pulls per hour from the docker hub got the release candidate instead of the expected stable version.

Unfortunately moving the git home directory in 1.17.0-rc1 was implemented in way that created a security problem. The fix that was merged in Gitea to fix it requires moving the gitconfig file and was released July 19th, 2022 in 1.17.0-rc2.

This would have been a minor inconvenience if it only has an impact on adventurous people trying the release candidate in a test environment. But since all Gitea production installations based on the latest tag were inadvertently upgraded to 1.17.0-rc1, the admins who moved their custom .gitconfig will need to move it one more time when upgrading to 1.17.0-rc2.

In 1.17.0-rc2, a custom .gitconfig must be moved manually to the new git home directory as follows:

$ 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 Data Root Path/home (which is /data/gitea/home in the example above).