Can not restore my repository backup


#1

Hello!

Please can anyone explain the correct workflow to restore my gogs backup? Unfortunately I am unable to restore my repositories. I tried several ways to restore my backups.

Git and MSSQL Server are already installed. I created the user Git_User on the database server. I created this user with full credentials, to avoid any installation errors.

I’d like to describe my problems. Unfortunately I don’t have the exact error messages at the moment because I’m in weekend now.

I have the files backup_git.zip and my gogs.bak

When I don’t restore gogs.bak on the server I got an error, like “can’t create table”.

When I restore gogs.bak I got an error like “can’t modify table”.

I set my custom app.ini in the restore command, the login credentials are ok, because I can use them on other ways.

What can I do to get my repositories back?

Kind regards
Christoph


#2

Maybe helpful: How to backup, restore and migrate


#3

I know this discription, but none of the advises solved my problem, each point fires an error. Next days I like to try to restore on a another machine, but I cant belive that the SQL Server is the problem.


#4

Sorry, I am still unable to restore my repositories.

When I create an empty database „gogs“ and run the restore command:

gogs restore --from="gogs-backup.zip" --config=custom/conf/app.ini

I get the following error message:

„[FATAL] Failed to import database: insert strcut: mssql: Cannot insert explicit value for identity column in table ‘user’ when IDENTITY_INSERT is set to OFF.“

When I restore the “gogs.bak” file to the server I get the same error message.

I defined the user “sa” in my app.ini, this user has the highest privileges.

What can I do?


#5

It is always good to search the error message: https://github.com/gogs/gogs/issues/4410


#6

Sorry, that doesn’t fix the problem. Or my usage is not correct maybe??

What is the next step I can do?

Kind regards
Christoph


#7

I think this is an unfixed bug according to #4410. I’ll see if I can push a patch, I think the fix might be made in the source code.

I don’t know MSSQL, but from MySQL perspective, brackets ([]) around table name is strange?

Maybe try SET IDENTITY_INSERT user ON


#8

Thank you very much!

The brackets are ok, for this I added the screenshot, to show the query was accepted. With the correct usage I meant the workflow of run the commands.

I look forward to the resolved problem!

Kind regards
Christoph


#9

Hello!

Is there a solution in sight? I like to get my repositories with his versioning back. What can I do otherwise?

Kind regards
Christoph


#10

If manually set IDENTITY_INSERT to ON is not working, any patch from main repository won’t help because this is how the patch would likely to work.


#11

BTW, backup and restore is database independent, so you could try to restore to another type of database (MySQL, PostgreSQL).