Migration from latest gogs (0.11.46.0418) is possible #1956

Closed
opened 2025-11-02 04:19:08 -06:00 by GiteaMirror · 24 comments
Owner

Originally created by @MegaphoneJon on GitHub (Jun 20, 2018).

The gitea documentation says you must upgrade from 0.9.146 of gogs, but (at least anecdotally) I'm able to upgrade from the latest version as of this writing (0.11.46.0418). I may submit a PR to the docs after I've run this in production for a few weeks, but for now I want to write this up so others can find it if necessary.

  • Gitea version (or commit ref): 1.4.2+6-gcaee487 built with: bindata, sqlite
  • Git version: 2.15.2
  • Operating system: Alpine Linux 3.7.0
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I migrated from one Docker image to another.

In addition to the steps outlined in the Upgrade from gogs doc, I also had to change every instance of gogs in my conf/app.ini file to gitea. I also had to change my PATH (under [database]) to /data/gitea/data/gitea.db (the gogs container has symlinks from /app that gitea doesn't). Also my ROOT_PATH (under log) changed from /app/gogs/log to /data/gitea/log.

Once I did that, I had gitea 1.0.2 working. Two more changes I had to make owing to my newer gogs version:

  • I had to regenerate my .ssh/authorized_keys file (from the Web UI's admin panel). Failure to do this resulted in the following error:
bash: /app/gogs/gogs: No such file or directory                                                          
fatal: Could not read from remote repository.
remote: ./hooks/pre-receive.d/pre-receive: line 2: /app/gogs/gogs: No such file or directory             
To ssh://git.example.com:10022/user/repo.git                                 
 ! [remote rejected]   master -> master (pre-receive hook declined) 

Finally - SSH push/pulls didn't work properly for me even after doing all these things until I upgraded to version 1.4. I couldn't upgrade directly - I assume this is related to #4424 - but I was able to go 1.0 » 11 » 1.2 » 1.3 » 1.4 painlessly. Once I was on 1.4 everything worked properly.

Originally created by @MegaphoneJon on GitHub (Jun 20, 2018). The gitea documentation says you must upgrade from 0.9.146 of gogs, but (at least anecdotally) I'm able to upgrade from the latest version as of this writing (0.11.46.0418). I may submit a PR to the docs after I've run this in production for a few weeks, but for now I want to write this up so others can find it if necessary. - Gitea version (or commit ref): 1.4.2+6-gcaee487 built with: bindata, sqlite - Git version: 2.15.2 - Operating system: Alpine Linux 3.7.0 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant ## Description I migrated from one Docker image to another. In addition to the steps outlined in the [Upgrade from gogs](https://docs.gitea.io/en-us/upgrade-from-gogs/) doc, I also had to change every instance of `gogs` in my `conf/app.ini` file to `gitea`. I also had to change my `PATH` (under `[database]`) to `/data/gitea/data/gitea.db` (the gogs container has symlinks from `/app` that gitea doesn't). Also my `ROOT_PATH` (under `log`) changed from `/app/gogs/log` to `/data/gitea/log`. Once I did that, I had gitea 1.0.2 working. Two more changes I had to make owing to my newer gogs version: * I had to regenerate my `.ssh/authorized_keys` file (from the Web UI's admin panel). Failure to do this resulted in the following error: ``` bash: /app/gogs/gogs: No such file or directory fatal: Could not read from remote repository. ``` * gogs generated a bunch of git hooks that reference the gogs binary. You can delete them from the UI or the command line (see the `find` command at https://github.com/go-gitea/gitea/issues/3558#issuecomment-372429183). If you don't delete them you'll receive the following error: ``` remote: ./hooks/pre-receive.d/pre-receive: line 2: /app/gogs/gogs: No such file or directory To ssh://git.example.com:10022/user/repo.git ! [remote rejected] master -> master (pre-receive hook declined) ``` Finally - SSH push/pulls didn't work properly for me even after doing all these things until I upgraded to version 1.4. I couldn't upgrade directly - I assume this is related to #4424 - but I was able to go 1.0 » 11 » 1.2 » 1.3 » 1.4 painlessly. Once I was on 1.4 everything worked properly.
GiteaMirror added the type/docsissue/stale labels 2025-11-02 04:19:08 -06:00
Author
Owner

@lunny commented on GitHub (Jun 21, 2018):

Please feel free to send a PR

@lunny commented on GitHub (Jun 21, 2018): Please feel free to send a PR
Author
Owner

@MegaphoneJon commented on GitHub (Jun 21, 2018):

I'm going to wait until this has been in production for a while before submitting a PR. I didn't analyze the database structure between a fresh gitea db and my own, for instance.

@MegaphoneJon commented on GitHub (Jun 21, 2018): I'm going to wait until this has been in production for a while before submitting a PR. I didn't analyze the database structure between a fresh gitea db and my own, for instance.
Author
Owner

@furai commented on GitHub (Jul 5, 2018):

Have you run into any issues so far?

@furai commented on GitHub (Jul 5, 2018): Have you run into any issues so far?
Author
Owner

@MegaphoneJon commented on GitHub (Jul 5, 2018):

@furai No, I haven't. I feel pretty confident at this point in what I did, so I'll make a TODO for myself to submit a PR to the documentation.

@MegaphoneJon commented on GitHub (Jul 5, 2018): @furai No, I haven't. I feel pretty confident at this point in what I did, so I'll make a TODO for myself to submit a PR to the documentation.
Author
Owner

@furai commented on GitHub (Jul 6, 2018):

Did you compare the databases?

@furai commented on GitHub (Jul 6, 2018): Did you compare the databases?
Author
Owner

@MegaphoneJon commented on GitHub (Jul 6, 2018):

@furai I haven't - which is why I need to set aside some time for this task. I was a bit glib in suggesting I just needed to write up my docs.

@MegaphoneJon commented on GitHub (Jul 6, 2018): @furai I haven't - which is why I need to set aside some time for this task. I was a bit glib in suggesting I just needed to write up my docs.
Author
Owner

@w-flo commented on GitHub (Jul 29, 2018):

Thanks, this seems to have worked for me starting from gogs 0.11.56.x.
Obviously I don't know if there are any DB inconsistencies. The DB migration process printed a bunch of yellow warnings (?) while migrating gitea from 1.0 to latest via the different 1.x releases, but maybe that's expected.

@w-flo commented on GitHub (Jul 29, 2018): Thanks, this seems to have worked for me starting from gogs 0.11.56.x. Obviously I don't know if there are any DB inconsistencies. The DB migration process printed a bunch of yellow warnings (?) while migrating gitea from 1.0 to latest via the different 1.x releases, but maybe that's expected.
Author
Owner

@marcolivier commented on GitHub (Jul 30, 2018):

Thanks for the instructions—it was a quick and easy transition from the latest version of Gogs to 1.0.2 and then slowly to 1.1, 1.2, 1.3, 1.4 and finally 1.5. I could've probably went straight to 1.5 but I wanted to play it safe.
I haven't encountered any problem yet but my DB was pretty small.

@marcolivier commented on GitHub (Jul 30, 2018): Thanks for the instructions—it was a quick and easy transition from the latest version of Gogs to 1.0.2 and then slowly to 1.1, 1.2, 1.3, 1.4 and finally 1.5. I could've probably went straight to 1.5 but I wanted to play it safe. I haven't encountered any problem yet but my DB was pretty small.
Author
Owner

@furai commented on GitHub (Aug 1, 2018):

I'm mostly interested whether PR and comments get migrated and all the settings for webhooks and git hooks. That's the most important thing for me.

@furai commented on GitHub (Aug 1, 2018): I'm mostly interested whether PR and comments get migrated and all the settings for webhooks and git hooks. That's the most important thing for me.
Author
Owner

@atom0s commented on GitHub (Aug 1, 2018):

I just migrated personally and yes, they all migrated with it. The only thing that had a problem was Discord web hooks had to be manually fixed in the database. (Gogs marks them as ID 3, Gitea is 4. So a simple query fixes it.) My experience with moving to Gitea here: https://github.com/go-gitea/gitea/issues/4538

@atom0s commented on GitHub (Aug 1, 2018): I just migrated personally and yes, they all migrated with it. The only thing that had a problem was Discord web hooks had to be manually fixed in the database. (Gogs marks them as ID 3, Gitea is 4. So a simple query fixes it.) My experience with moving to Gitea here: https://github.com/go-gitea/gitea/issues/4538
Author
Owner

@furai commented on GitHub (Aug 1, 2018):

That's good news. What secret are you talking about in your issue? What can it be used for? I'm trying to figure out if my users might have been relying on it.

@furai commented on GitHub (Aug 1, 2018): That's good news. What secret are you talking about in your issue? What can it be used for? I'm trying to figure out if my users might have been relying on it.
Author
Owner

@atom0s commented on GitHub (Aug 1, 2018):

With the web hooks, there is a secret key that can be sent with the hooks request. On Gogs, this was more recently changed on how it was sent. It used to be sent as "secretkey" inside of the data (json blob) but was changed to be a header and was also changed to be a hash of the key vs. the raw key itself.

On Gitea, this is reverted back to the old setup of Gogs where its sent in the data and is the raw key.

@atom0s commented on GitHub (Aug 1, 2018): With the web hooks, there is a secret key that can be sent with the hooks request. On Gogs, this was more recently changed on how it was sent. It used to be sent as "secretkey" inside of the data (json blob) but was changed to be a header and was also changed to be a hash of the key vs. the raw key itself. On Gitea, this is reverted back to the old setup of Gogs where its sent in the data and is the raw key.
Author
Owner

@techknowlogick commented on GitHub (Aug 1, 2018):

On Gitea, this is reverted back

To be clear it was not reverted back, Gitea forked from Gogs at a certain point, and no developer contributed the code to Gitea that was contributed to Gogs. There is a ticket for this functionality to be added, however no developer has taken up the cause to add it to Gitea. Perhaps you could.

Edit: #3901 is the ticket I am referencing.

@techknowlogick commented on GitHub (Aug 1, 2018): > On Gitea, this is reverted back To be clear it was not reverted back, Gitea forked from Gogs at a certain point, and no developer contributed the code to Gitea that was contributed to Gogs. There is a ticket for this functionality to be added, however no developer has taken up the cause to add it to Gitea. Perhaps you could. Edit: #3901 is the ticket I am referencing.
Author
Owner

@Obihoernchen commented on GitHub (Sep 29, 2018):

Just upgraded latest Gogs 0.11.66 to Gitea 1.5.1 👍

I copied my gogs mysql database, followed https://docs.gitea.io/en-us/upgrade-from-gogs/, edited my app.ini and upgraded from 1.0.2 > 1.1.4 > 1.2.3 > 1.3.3 > 1.4.3 > 1.5.1. A direct upgrade from 1.02 to 1.5.1 failed, so I upgraded step by step.
Afterwards go to Admin panel and regenerate hooks, update ssh keys etc.

Edit: Have a look in gitea-repositories and search for gogs grep -R gogs. There might be some hook leftovers you have to delete.

So far everything seems to work as expected 👍

@Obihoernchen commented on GitHub (Sep 29, 2018): Just upgraded latest Gogs 0.11.66 to Gitea 1.5.1 :+1: I copied my gogs mysql database, followed https://docs.gitea.io/en-us/upgrade-from-gogs/, edited my app.ini and upgraded from 1.0.2 > 1.1.4 > 1.2.3 > 1.3.3 > 1.4.3 > 1.5.1. A direct upgrade from 1.02 to 1.5.1 failed, so I upgraded step by step. Afterwards go to Admin panel and regenerate hooks, update ssh keys etc. Edit: Have a look in `gitea-repositories` and search for gogs `grep -R gogs`. There might be some hook leftovers you have to delete. So far everything seems to work as expected :+1:
Author
Owner

@stale[bot] commented on GitHub (Jan 7, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 7, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@nougad commented on GitHub (Feb 3, 2019):

I was able to directly update from gogs 0.11.79 (archlinux aur) to gitea 1.7.1 (archlinux community) with postgres.

Steps done:

  • Stop Gogs and backup everything
  • Downgrade database to older version update version set version = 13
  • Install gitea (reconfigure, change permission, change paths, ...)
  • Delete old git hooks: rm /var/lib/gitea/repo/*/*.git/hooks/post-receive.d/post-receive /var/lib/gitea/repo/*/*.git/hooks/pre-receive.d/pre-receive and execute Resynchronize pre-receive, update and post-receive hooks of all repositories. in gitea

Afterwards everything was working. While I would not necessarily recommend it, at least I want to mention that it's possible.

(ref: https://github.com/go-gitea/gitea/issues/5318)

@nougad commented on GitHub (Feb 3, 2019): I was able to directly update from gogs 0.11.79 (archlinux aur) to gitea 1.7.1 (archlinux community) with postgres. Steps done: * Stop Gogs and backup everything * Downgrade database to older version `update version set version = 13` * Install gitea (reconfigure, change permission, change paths, ...) * Delete old git hooks: `rm /var/lib/gitea/repo/*/*.git/hooks/post-receive.d/post-receive /var/lib/gitea/repo/*/*.git/hooks/pre-receive.d/pre-receive` and execute `Resynchronize pre-receive, update and post-receive hooks of all repositories.` in gitea Afterwards everything was working. While I would not necessarily recommend it, at least I want to mention that it's possible. (ref: https://github.com/go-gitea/gitea/issues/5318)
Author
Owner

@KuDeSnik33ra commented on GitHub (Feb 13, 2019):

Where "update version set version = 13" should be executed?

@KuDeSnik33ra commented on GitHub (Feb 13, 2019): Where "update version set version = 13" should be executed?
Author
Owner

@lafriks commented on GitHub (Feb 13, 2019):

@KuDeSnik33ra in your database tools connected to Gitea database

@lafriks commented on GitHub (Feb 13, 2019): @KuDeSnik33ra in your database tools connected to Gitea database
Author
Owner

@stale[bot] commented on GitHub (Apr 14, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 14, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@ottes commented on GitHub (Apr 16, 2019):

Migration itself worked fine from gogs 0.11, but all my users were ldap users (except one admin user) and they are not able to login anymore.
The users are there, all have the correct auth source, the ldap auth-settings itself are correct too, but i can't select the auth-method on the login page.

I'm using sqlite database and can't see any other errors in the log or any other place, any idea?

@ottes commented on GitHub (Apr 16, 2019): Migration itself worked fine from gogs 0.11, but all my users were ldap users (except one admin user) and they are not able to login anymore. The users are there, all have the correct auth source, the ldap auth-settings itself are correct too, but i can't select the auth-method on the login page. I'm using sqlite database and can't see any other errors in the log or any other place, any idea?
Author
Owner

@lafriks commented on GitHub (Apr 18, 2019):

You don't need to select auth method on login page. If you have configured and enabled auth source in login page users should authorize standard username/password login

@lafriks commented on GitHub (Apr 18, 2019): You don't need to select auth method on login page. If you have configured and enabled auth source in login page users should authorize standard username/password login
Author
Owner

@stale[bot] commented on GitHub (Jun 17, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jun 17, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Jul 1, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Jul 1, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Author
Owner

@louzadod commented on GitHub (Nov 3, 2020):

Where "update version set version = 13" should be executed?

It is a SQL update on the Gogs database. Postgresql in my case.

@louzadod commented on GitHub (Nov 3, 2020): > Where "update version set version = 13" should be executed? It is a SQL update on the Gogs database. Postgresql in my case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1956