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).

#12

Thank you for your reply!

I tried to restore to SQLite3. Now I get this error:

What a pity…

Please can you describe the exact workflow to restore to SQLite ?

Kind regards
Christoph

#13

You should first solve the problem “login failed”, this is out of control of Gogs.

#14

Hello,

actually I can use Git via Gogs. I can create repositories and work with them, so my configuration seems to be ok. What is the problem?

Is restore –from”gogs-backup.zip” the right command in my case?

Kind regards
Christoph

#15

Back again,

I created a Test-Repository on my new system with SQLite und did a backup. I deleted the Test-Repository via git – webinterface – admin area. Afterword’s I started the restore command restore –from”gogs-backup.zip” and it runs as expected, the restore was successful! So my restore command is ok! I tried to restore my real backup again, I got the same error message as above shown. I think it is not possible to restore MSSQL Backups to MSSQL and also to SQLite databases.

I think I lost my versioning of al of my projects! Is it so, or is there a way out?

#16

Your Git data are stored the path you defined. REPOSITORY_ROOT

#17

Sorry, what do you mean exactly with ‘Your Git data are stored the path you defined.

This is my root path in the current config file.

ROOT_PATH = C:/Users/UserName/gogs/log

The path equals the path in the config file of the backup.

#18

… interesting, first time see people name a directory that stores actual data as “log”.

#19

This Path comes form the installation, I never edited this path, I tried this just for a second!

#20

Nope… the default value for repository root ends with gogs-repositories for a fresh installation.